Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Functions cannot return type trigger

I'm using PostgreSQL with pgAdmin and I can't get a trigger function to work. However, as far as I am aware, you can return 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();
like image 601
user195257 Avatar asked Apr 06 '11 12:04

user195257


1 Answers

SOLVED, had to change language to PLPGSQL

like image 92
user195257 Avatar answered Nov 04 '22 00:11

user195257