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?