我想在 Postgresql 中使用触发器调用存储过程。是否可以?
这是一个例子:
create table foo(n int primary key, n1 int);
create or replace procedure set_column_value(value int)
language plpgsql
:as $$
begin
update foo
set n1 = id
commit;
end;$$
Run Code Online (Sandbox Code Playgroud)
触发器类似于:在 foo 上插入或更新后,调用存储过程 set_column_value(new.n)