Re: Delete Trigger Issue

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Sundararajan <sdn(at)srasys(dot)co(dot)in>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Delete Trigger Issue
Date: 2001-08-07 05:42:03
Message-ID: Pine.BSF.4.21.0108062232420.32102-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Grigoriy G. Vovk 2001-08-07 08:13:55 RE: Delete coloumn
Previous Message Robby Slaughter 2001-08-07 05:28:28 RE: Delete Trigger Issue