I would like to call a stored procedure using a trigger in Postgresql. Is it possible?

Here is an example:

create table foo(n int primary key, n1 int);     

create or replace procedure set_column_value(value int)
language plpgsql
:as $$
 update foo
 set n1 = id

The trigger would be something like: After insert or update on foo, call the stored procedure set_column_value(new.n)


1 Answer 1


No, a trigger needs to call a trigger function. But there is nothing that keeps you from writing a PL/pgSQL trigger function that CALLs the procedure of your liking.

  • 2
    But, you won't be able to invoke COMMIT in such a CALL;
    – jjanes
    Sep 29, 2021 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.