Re: DELETE syntax on JOINS - Mailing list pgsql-hackers

From Tom Lane
Subject Re: DELETE syntax on JOINS
Date
Msg-id 9095.1251158094@sss.pgh.pa.us
Whole thread Raw
In response to Re: DELETE syntax on JOINS  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Bruce Momjian <bruce@momjian.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


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: 8.5 release timetable, again
Next
From: Tom Lane
Date:
Subject: Re: 8.5 release timetable, again