Hello,
I have a child table with
CONSTRAINT fkey FOREIGN KEY (x)
REFERENCES master (x) MATCH SIMPLE ON UPDATE CASCADE ON DELETE
CASCADE.
and
CREATE TRIGGER td_y AFTER
DELETE ON chlid FOR EACH ROW EXECUTE PROCEDURE
fn_td_y();
and this trigger refers to the master
table...
CREATE OR REPLACE FUNCTION fn_td_y() RETURNS
trigger AS
$BODY$ DECLARE fi integer; BEGIN SELECT i INTO
fi FROM master WHERE x = old.x;
...
It seems that SELECT results to null, so the master
has already deleted the row. Is this intended and how can I solve
this?
Regards,
Teemu Juntunen
|