From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Lewis <mlewis@entrata.com>
Cc: Nikhil Benesch <nikhil.benesch@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: DELETE ... USING LATERAL
Date: Mon, 04 Oct 2021 15:27:31 -0400
Message-ID: <4004827.1633375651@sss.pgh.pa.us> (raw)
In-Reply-To: <CAHOFxGrtOqV_CdyZktPSFHKnom3jscF_YTGdZRmmQ_7weARJQw@mail.gmail.com>
References: <CAPWqQZQQWDX2A4zzEyJ_rqks0zCOaC2r2yjN4bAcEVhKb0V5AQ@mail.gmail.com>
<CAHOFxGrtOqV_CdyZktPSFHKnom3jscF_YTGdZRmmQ_7weARJQw@mail.gmail.com>
Michael Lewis <mlewis@entrata.com> writes:
> On Mon, Oct 4, 2021, 10:30 AM Nikhil Benesch <nikhil.benesch@gmail.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, mlewis@entrata.com, nikhil.benesch@gmail.com
Subject: Re: DELETE ... USING LATERAL
In-Reply-To: <4004827.1633375651@sss.pgh.pa.us>
References: <CAPWqQZQQWDX2A4zzEyJ_rqks0zCOaC2r2yjN4bAcEVhKb0V5AQ@mail.gmail.com> <CAHOFxGrtOqV_CdyZktPSFHKnom3jscF_YTGdZRmmQ_7weARJQw@mail.gmail.com> <4004827.1633375651@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox