Trigger uses a procedure or a function?
PostgreSQL version 10 and before use the term "Trigger Procedure" ( https://www.postgresql.org/docs/10/plpgsql-trigger.html ). But later versions use the term "Trigger Function".
What is the reason for changing that term?
Demir last edited by
https://www.postgresql.org/docs/current/sql-createtrigger.html have always been using functions, not procedures. Unfortunately, the terminology is fuzzy, many use "stored procedure" as umbrella term for both functions and procedures.
Thus the widespread misnomer "procedure" had crept in, spreading even to the syntax of
CREATE TRIGGER ... EXECUTE PROCEDUREwhere a function name is required. That was a merely academic nuisance while Postgres only had functions, not procedures. See:
Postgres 11 eventually added true https://www.postgresql.org/docs/current/sql-createprocedure.html , which elevated that misleading terminology to a real problem. So the manual fixed its wording, and the proper syntax variant
CREATE TRIGGER ... EXECUTE FUNCTIONwas added, which is preferred going forward. The old variant is still accepted for compatibility reasons - and will be for quite a while longer until that can finally be dropped for good.