Re: DELETE syntax on JOINS

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Jean-Michel Pouré <jm(at)poure(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: DELETE syntax on JOINS
Date: 2009-08-24 16:29:00
Message-ID: 20090824122900.f70e59c2.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In response to Bruce Momjian <bruce(at)momjian(dot)us>:

> Alvaro Herrera wrote:
> > Bruce Momjian wrote:
> >
> > > > Ultimately, why not allow:
> > > >
> > > > DELETE h, tn
> > > > FROM history AS h
> > > > INNER JOIN term_node AS tn ON (h.nid = tn.nid)
> > > > INNER JOIN term_data AS td ON (td.tid = tn.tid)
> > > > WHERE h.uid = 2067 AND td.vid = 2
> > > >
> > > > IMHO this would improve compliance towards other database systems. To me
> > > > this seems to be in the reasonable scope of compatibility.
> > >
> > > Which "other database systems"? Only MySQL? If it is MySQL-only, we
> > > are unlikely to add it.
> >
> > The SQL standard does not support this syntax. They would have you put
> > the joins in a subselect (which is often not enough because then you
> > can't use outer joins).
>
> So the problem is that our DELETE ... USING does not allow ANSI join
> syntax? Can that be added?

I suspect that the reason MySQL has this syntax is because for a long time
they didn't have proper foreign keys and referential integrity.

With proper foreign keys and ON DELETE CASCADE, why would supporting
such syntax even be necessary?

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-24 16:34:15 Re: hba load error and silent mode
Previous Message Magnus Hagander 2009-08-24 16:28:38 Re: hba load error and silent mode