After delete trigger problem - Mailing list pgsql-general

From Teemu Juntunen
Subject After delete trigger problem
Date
Msg-id 245949AFD379488D85413B196C3CBA62@eng02
Whole thread Raw
Responses Re: After delete trigger problem
Re: After delete trigger problem
List pgsql-general
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
 

pgsql-general by date:

Previous
From: Bruno Lavoie
Date:
Subject: Re: Importing text file into a TEXT field
Next
From: Tom Lane
Date:
Subject: Re: After delete trigger problem