help on delete trigger. - Mailing list pgsql-novice

From Sundararajan
Subject help on delete trigger.
Date
Msg-id 033501c11f00$5f9a8df0$3d0210ac@arula
Whole thread Raw
Responses Re: [GENERAL] help on delete trigger.  (Jan Wieck <JanWieck@Yahoo.com>)
List pgsql-novice
I am developing a db application in postgresql and i need to write a delete trigger on one of the tables.
 
the environment is
 
table1
 
field1 varchar(64)
other fields.
 
table 2.
 
field1 varchar(64)
other fields
 
I need a delete trigger on the table 1, so that if I delete a row from table 1 , the corresponding rows from table 2 should also be deleted.
 
This is the code I have tried.
 
DROP FUNCTION ApplicationsDeleteFn();
CREATE FUNCTION ApplicationsDeleteFn()
RETURNS OPAQUE
AS '
 BEGIN
delete from ports where appName=OLD.appName;
 RETURN OLD;
 
 END;
'
LANGUAGE 'plpgsql';
 
Please help me with this, as my work is time bound.
 
Thanks
sundar

pgsql-novice by date:

Previous
From: "Johann Zuschlag"
Date:
Subject: Re: Overwriting Operator for numeric and float8 fails
Next
From: "Johann Zuschlag"
Date:
Subject: Overwriting Operator for numeric and float8 fails