On 2016/10/19 2:51, Robert Haas wrote:
On Fri, Oct 14, 2016 at 12:05 AM, Etsuro Fujita
<fujita.ets...@lab.ntt.co.jp> wrote:
I think it's better to mention that an alias is needed for the target table
specified in the USING clause of a DELETE statement, to set up a self-join,
as the documentation on the from_list parameter of UPDATE does.  Please find
attached a patch.

The statement you are proposing to add to the documentation isn't true.

Consider a counterexample of DELETE doing a self-join of a target table:

postgres=# create table t1 (c1 int);
CREATE TABLE
postgres=# insert into t1 values (1);
INSERT 0 1
postgres=# delete from t1 using t1 where t1.c1 = t1.c1;
ERROR:  table name "t1" specified more than once

Giving an alias to the target table t1 in the USING clause,

postgres=# delete from t1 using t1 r1 where t1.c1 = r1.c1;
DELETE 1

Am I missing something?

Sorry for the delay.

Best regards,
Etsuro Fujita




--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to