Re: DELETE syntax on JOINS

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 23:54:54
Message-ID: 9095.1251158094@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> What we cannot currently do is reference test twice:

> test=> DELETE FROM test USING test;
> ERROR: table name "test" specified more than once

> test=> DELETE FROM test t USING test t;
> ERROR: table name "t" specified more than once

Hmm, I had forgotten that we throw errors in these cases now.
Maybe that *would* give us an escape-hatch for the other interpretation.

> As far as I understand it, allowing ANSI joins in USING would simple
> mean removing that error message and linking the two table aliases.

Well, you'd still need to complain about

DELETE FROM test USING test JOIN test ON ...

Also, it's not nearly as easy as just removing the error check.
There's stuff in the planner (and perhaps executor) that's dependent on
the assumption that the target table isn't on the inside of an outer
join, for example. Still, getting agreement on a syntax would in itself
be a huge step forward.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-25 00:02:31 Re: 8.5 release timetable, again
Previous Message Josh Berkus 2009-08-24 23:49:48 Re: 8.5 release timetable, again