Re: deleting a row potentially referenced by many rows in another table
Date: Tue, 29 Sep 2009 12:31:10 -0700 (PDT)
> Yeah, off-hand all that comes to mind is a trigger that fires on
> DELETEs and does an EXISTS test. Since your PK and, almost certainly,
> FK columns are indexed, the performance may be acceptable. Which RDBMS
> are you running?
I am running MySQL. Yes, the trigger approach was suggested to me separately, and probably could be made to work. I am wondering about concurrency issues though. Suppose the EXISTS test indicates that no FKs reference the applicable parent row when the check is made, but, before the delete of the parent row can be made, another insert finds the parent row already exists and references it.
Carl Received on Tue Sep 29 2009 - 21:31:10 CEST