Re: delete with referential integrity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Zouroudis <mzouroudis(at)idealcorp(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: delete with referential integrity
Date: 2002-08-29 17:37:31
Message-ID: 19787.1030642651@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Michael Zouroudis <mzouroudis(at)idealcorp(dot)com> writes:
> because of integrity constraints, i have to
> delete the record from book_asset, then book, and finally assets. all
> inserts, updates, and deletes are done through the assets table, and i
> have a trigger on assets that first deletes book_asset, then books, and
> finally assets. the problem is when it deletes assets on that third
> delete, it sends the db into a recursive loop(the delete on assets
> starts the trigger again).

Why don't you simply let the system carry on with the deletion that the
trigger was called for?

Seems to me the answer to the problem "my trigger is infinitely
recursive" is "make your trigger not recurse".

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2002-08-29 17:39:51 Re: Interpretting WAL debug.
Previous Message Randall Perry 2002-08-29 17:31:10 Access 'field too long' error