SQL functions cannot return a trigger of type

I am using PostgreSQL with pgAdmin and I cannot get the trigger function to work. However, as far as I know, can you return a type trigger in PostgreSQL?

CREATE OR REPLACE FUNCTION validate_Cat() 
  RETURNS TRIGGER AS 
$BODY$
BEGIN
    -- CODE here
END;
$BODY$
  LANGUAGE SQL;

CREATE TRIGGER validate_Cat
AFTER INSERT OR UPDATE ON Category
FOR EACH ROW execute procedure validate_Cat();
+7
source share
1 answer

Solved, had to change the language to PLPGSQL

+12
source

All Articles