On May 13, 2009, at 8:48 PM, Michael P. Soulier wrote:

Can someone suggest a better way that doesn't hit this "pending trigger"
issue while in a transaction?


IIRC you had an initially deferred foreign key constraint? Do you absolutely need that to be initially deferred, or deferrable even? Because that's what's causing your problem, not the foreign key constraint itself.

If that FK does need to be initially deferred, as a workaround you can temporarily disable the foreign key while doing your updates. Easiest is to drop the constraint, do your updates and recreate the constraint, at which point the database will verify that the related records match the constraint. Of course this opens a risk where a record gets inserted that doesn't match your FK constraint which will cause recreation to error out and your transaction to rollback.

Alban Hertroys

--
If you can't see the forest for the trees,
cut the trees and you'll see there is no forest.


!DSPAM:737,4a0d321a10092082955122!



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to