Re: Minor improvement to delete.sgml

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Minor improvement to delete.sgml
Date: 2016-11-14 03:55:38
Message-ID: c04315e3-7c63-5f21-a4f7-7b36962d4473@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2016/10/19 2:51, Robert Haas wrote:
> On Fri, Oct 14, 2016 at 12:05 AM, Etsuro Fujita
> <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-11-14 04:03:24 Re: Fix checkpoint skip logic on idle systems by tracking LSN progress
Previous Message Kyotaro HORIGUCHI 2016-11-14 03:49:29 Re: Fix checkpoint skip logic on idle systems by tracking LSN progress