Re: DELETE ... USING LATERAL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Lewis <mlewis(at)entrata(dot)com>
Cc: Nikhil Benesch <nikhil(dot)benesch(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: DELETE ... USING LATERAL
Date: 2021-10-04 19:27:31
Message-ID: 4004827.1633375651@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Lewis <mlewis(at)entrata(dot)com> writes:
> On Mon, Oct 4, 2021, 10:30 AM Nikhil Benesch <nikhil(dot)benesch(at)gmail(dot)com>
> wrote:
>> # delete from int_arrays using int_arrays;
>> ERROR: table name "int_arrays" specified more than once

>> Don't you need to use an alias for the table in the using clause?

You could, but then you'd be creating a self-join on the target table
(and would need to add suitable WHERE clauses to constrain that join).
This might be the best near-term workaround, but it does seem ugly
and inefficient.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Shaozhong SHI 2021-10-04 20:13:25 Re: Testing of a fast method to bulk insert a Pandas DataFrame into Postgres
Previous Message Alvaro Herrera 2021-10-04 19:24:10 Re: Postgres PANIC when it could not open file in pg_logical/snapshots directory