cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Olmes <d...@xanthippe.ping.de>
Subject Re: Recursive FK constraints in MySql
Date Sat, 24 Sep 2011 03:26:53 GMT
On 09/22/2011 06:21 PM, Chris Murphy (www.strandz.org) wrote:
> I want to delete a row from a particular table. Unfortunately the table in
> question has a FK constraint to another table, which in turn has a FK
> constraint back to the table in question. Even the latest version of MySql
> (I tried 5.5) does constraint checking on a per-statement rather than
> per-transaction basis. Basically the constraints are always tripped and the
> only way I've found to allow the delete to proceed is to drop the FK
> constraints.

I'm not a MySQL expert but the usual approach I used with FK constraint
is to declare them as DEFERRABLE INITIALLY DEFERRED. This way, the
constraints won't be checked until all the updates to the tables have
been made.

-dirk

Mime
View raw message