help on delete trigger.

From: "Sundararajan" <sdn(at)srasys(dot)co(dot)in>
To: <pgsql-general(at)postgresql(dot)org>
Cc: <pgsql-novice(at)postgresql(dot)org>
Subject: help on delete trigger.
Date: 2001-08-07 05:18:20
Message-ID: 033501c11f00$5f9a8df0$3d0210ac@arula
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message hubert depesz lubaczewski 2001-08-07 06:43:14 int8 indices?
Previous Message Tom Lane 2001-08-07 03:13:06 Re: Database handle destroyed without explicit disconnect

Browse pgsql-novice by date

  From Date Subject
Next Message Phillip J. Allen 2001-08-07 12:49:06 Can Functions be written in C++ or only C?
Previous Message Il Paolone 2001-08-06 20:25:06 restoring a 7.1 dump on a 6.5.x postgresql