问题描述
我正在尝试在 postgre (9.6) 数据库中创建触发器。
我的目标是将最后插入的行应用到文件中。
我可以通过使用以下代码对整个表格进行copY
来使其工作。
我的问题是:如何使用 copY 附加数据?以及如何仅使用最后插入的行?
这是我的代码。
create function test_function() returns trigger as $test_trigger$
begin
copy (select * from my_table) to 'C:\Temp\stats.txt';
return NEW;
end;
$test_trigger$ language plpgsql;
create trigger test_trigger after insert on my_table
for each row
execute procedure test_function();
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)