Forum OpenACS Development: problem preforming double deletion

Collapse
Posted by BamBam peled on
problem preforming double deletion
i want to write a trigger that causes another record to be deleted from another table something like this :
/*************function***********************/

CREATE OR REPLACE FUNCTION policy.on_delete_user_general_rule()
RETURNS "trigger" AS
$BODY$
BEGIN
DELETE FROM policy.general_rules WHERE id= OLD.rule_id ;
END;$BODY$
LANGUAGE 'plpgsql' STABLE;
ALTER FUNCTION policy.on_delete_user_general_rule() OWNER TO postgres;
GRANT EXECUTE ON FUNCTION policy.on_delete_user_general_rule() TO postgres;

/*****************the trigger*******************/

CREATE TRIGGER "1232"
BEFORE DELETE
ON policy.user_general_rules
FOR EACH ROW
EXECUTE PROCEDURE policy.on_delete_user_general_rule();

and i keep getting errors on line 2

any ideas anyone ??

Collapse
Posted by BamBam peled on
in case i forgot to say it's all in: plpgsql

the purpose is to trigger a deletion of a ro from table B after another raw was deleted from table A
and don't tell me i know the design sux
10x in advance .