[英]After insert trigger in postgres not working
i am creating a trigger that is supposed to be fired every time a new device is added in to the device table.我正在创建一个应该在每次将新设备添加到设备表时触发的触发器。 Since the id in the table is auto incrementing i have set is so that the trigger is fired after the insert.
由于表中的 id 是自动递增的,因此我已设置为在插入后触发触发器。 The insertion works but the trigger is not being fired or atleast i am not seeing the data in the table that is supposed to receive the information.
插入有效,但触发器没有被触发,或者至少我没有看到表中应该接收信息的数据。
the function function
CREATE OR REPLACE function insertstagingdevice() returns trigger as $device$
DECLARE
begin
INSERT INTO postgres.staging_import_remote_access.device(device_id,
name, eui,
location)
VALUES(new.id,
new.name,
new.eui,
new.location);
RETURN NEW;
END
$device$ language plpgsql;
The trigger触发
CREATE TRIGGER insertionIntoDevice
after INSERT
ON postgres.public.device
FOR EACH row
EXECUTE PROCEDURE insertstagingdevice();
Is there something i am overseeing?有什么我正在监督的吗?
The code is correct.代码是正确的。 there was an error elswehere.
其他地方有错误。 Thanks for your help
谢谢你的帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.