Re: Delete Trigger Issue - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Delete Trigger Issue
Date
Msg-id Pine.BSF.4.21.0108062232420.32102-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Delete Trigger Issue  ("Sundararajan" <sdn@srasys.co.in>)
List pgsql-sql
On Tue, 7 Aug 2001, Sundararajan wrote:

> I am developing a db application in postgresql and i need to write a delete
> trigger on one of the tables.
> 
> 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.

Well, if you want the other semantics (not allow rows in 2 that don't
match rows in 1, etc) you could use a foreign key rather than an explicit
trigger.

> 
> 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';

Are you actually making the trigger?  What does it do
when you try to make the trigger and then when you try
to delete?



pgsql-sql by date:

Previous
From: "Robby Slaughter"
Date:
Subject: RE: Delete Trigger Issue
Next
From: "Grigoriy G. Vovk"
Date:
Subject: RE: Delete coloumn