Re: Many-to-many with both FK cascading deletes?

From: -CELKO- <jcelko212_at_earthlink.net>
Date: Sun, 20 Jun 2010 06:35:36 -0700 (PDT)
Message-ID: <44d955d8-c096-4c9d-abca-e51491088688_at_u7g2000yqm.googlegroups.com>


>> are there any complications in general with a many-to-many "join table" having cascading deletes on both foreign keys to the interconnected tables? After all, this means that the "link entities" get deleted whoever comes first... could this pose a problem? <<

The ANSI/ISO model is that first you mark all the rows in all the tables with a delete flag. If no constraints are violated, then a second pass does the actual removal. If a constaint is violated at any point, then the engine does a rollback and sends an exception.

The multiple passes can be expensive, but they are safe. Received on Sun Jun 20 2010 - 15:35:36 CEST

Original text of this message