PostgreSQL Syntax error at or near FUNCTION on create trigger PostgreSQL Syntax error at or near FUNCTION on create trigger postgresql postgresql

PostgreSQL Syntax error at or near FUNCTION on create trigger


The EXECUTE FUNCTION syntax for CREATE TRIGGER statements was introduced in Postgres 11.

In Postgres 10, you need to say EXECUTE PROCEDURE instead.

This syntax was deprecated in Postgres 11 with the introduction of procedures, which are distinct from functions and cannot be used to implement a trigger.


If you are trying to add trigger function from pgadmin UI,In the code tab you need to specify function from BEGIN to END, as postgres implicitly specifies in the code " CREATE OR REPLACE FUNCTION ****()RETURNS TRIGGERAS$$"