触发液体中的诱因
我正在使用PostgreSQL和我两个表客户(ID,名称,地址,城市)和update_customer(ID,时间)。每当我在客户表中插入一个新值时,我想将该ID和时间存储在update_customer表中。但是我目前有一个例外,我对出了什么问题没有任何想法。
代码:
<changeSet author="newUser" id="03">
<sql>
CREATE TRIGGER customer_trigger
AFTER INSERT ON customer
FOR EACH ROW
EXECUTE PROCEDURE customer_update();
CREATE FUNCTION customer_update() RETURNS trigger AS $example_table$
BEGIN
INSERT INTO update_customer(id,time) VALUES (NEW.id , current_timestamp);
RETURN NEW;
END;
</sql>
</changeSet>
错误
Caused by: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/trigger.xml::03::newUser:
I am using postgresql and I two tables customer (id , name, address, city) and update_customer(id, time). When ever I insert a new value in customer table I want to store that id and time in update_customer table. But I am currently getting an exception and I dont have an idea about what went wrong.
code:
<changeSet author="newUser" id="03">
<sql>
CREATE TRIGGER customer_trigger
AFTER INSERT ON customer
FOR EACH ROW
EXECUTE PROCEDURE customer_update();
CREATE FUNCTION customer_update() RETURNS trigger AS $example_table$
BEGIN
INSERT INTO update_customer(id,time) VALUES (NEW.id , current_timestamp);
RETURN NEW;
END;
</sql>
</changeSet>
error
Caused by: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set db/changelog/trigger.xml::03::newUser:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用“ createProcedure”标签为我带来了困难,我不为什么在使用'sql'标签液体时不断丢弃错误,说插入附近是错误的。
Using 'createProcedure' tag did the trick for me, I dont why while using 'sql' tag Liquibase kept on throwing errors saying something is wrong near Insert.