Update CREATE TRIGGER syntax to use EXECUTE FUNCTION
Prior to Postgres 11, the syntax for creating a trigger was:
CREATE TRIGGER ... EXECUTE PROCEDURE function_name (arguments)
They keyword PROCEDURE
was used even though the trigger called a Postgres FUNCTION
created with the CREATE FUNCTION
command.
Postgres 11 added procedures as a separate concept from functions, with some differences in semantics. As a result, it seems the syntax for creating a trigger was updated to accept either EXECUTE PROCEDURE
or EXECUTE FUNCTION
, with the latter now being preferred. The official docs say:
In the syntax of CREATE TRIGGER, the keywords FUNCTION and PROCEDURE are equivalent, but the referenced function must in any case be a function, not a procedure. The use of the keyword PROCEDURE here is historical and deprecated.
For reference: https://www.postgresql.org/docs/11/sql-createtrigger.html
In PG 12, it seems the pg_get_triggerdef()
function has also been updated to display the trigger definition using the FUNCTION
keyword instead of the PROCEDURE
keyword, so the app should use the new terminology going forward.