Re: DELETE syntax on JOINS

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: 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:22:49
Message-ID: 200908241622.n7OGMn400515@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera wrote:
> Bruce Momjian wrote:
> > 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?
>
> Not sure about that. USING is already an extension to the standard, so
> if we extend it a bit more, it can't be a problem, can it? But this
> doesn't solve Jean Michel's problem, because MySQL does not support
> DELETE USING (or does it?).

Right, but if we support ANSI joins in the USING clause, at least we
would have a _functional_ equivalent, which we don't know because of
missing outer join support.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Browne 2009-08-24 16:24:15 Re: 8.5 release timetable, again
Previous Message Tom Lane 2009-08-24 16:19:28 Re: compilation with libeditpreferred is broken