Re: Add Missing From? - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: Add Missing From?
Date
Msg-id 200408101156.19796.josh@agliodbs.com
Whole thread Raw
In response to Add Missing From?  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
Harald,

> You're talking about "the deletion target table".  Sorry to mention
> the M word again, but MySQL allows deleting from more than one table
> at the same time.  Should we support that?

Nope.   In fact, I'd argue pretty strongly against any move to do so.

MySQL supports multi-table delete for 2 reasons:
1) MySQL does not support CASCADE Foriegn Keys, and as a result this is the
only way they can "clean out" all related records.
2) To be blunt: MySQL doesn't care about your data.  Just look at their
implementation of constraints.

Since we do support CASCADE FKs, there is no reason for us to support this
syntax; just set your FKs up correctly and it's taken care of.   Were we to
consider implementing this, the implementors would have to answer the
following questions:

A) In what order are the rows deleted, from which table first?
B) If no join criteria are supplied, is it OK to delete all rows from one of
the tables?  If not, how do you deliberately clean out a table?
C) If one of the tables had FKs or triggers that affect one of the other
tables, when do these get evaluated/fired?

Overall, I consider it a very, very bad idea.

--
-Josh Berkus"A developer of Very Little Brain"Aglio Database SolutionsSan Francisco



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Why is WIN 1250 client only?
Next
From: Peter Eisentraut
Date:
Subject: Re: Missing French backend translations in the HEAD