Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXTcg-0007b2-D3 for pgsql-general@arkaria.postgresql.org; Mon, 04 Oct 2021 19:27:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mXTcf-0005m0-Br for pgsql-general@arkaria.postgresql.org; Mon, 04 Oct 2021 19:27:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXTcf-0005lr-2n for pgsql-general@lists.postgresql.org; Mon, 04 Oct 2021 19:27:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mXTcd-0002D4-3K for pgsql-general@lists.postgresql.org; Mon, 04 Oct 2021 19:27:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 194JRVTn4004828; Mon, 4 Oct 2021 15:27:31 -0400 From: Tom Lane To: Michael Lewis cc: Nikhil Benesch , "pgsql-generallists.postgresql.org" Subject: Re: DELETE ... USING LATERAL In-reply-to: References: Comments: In-reply-to Michael Lewis message dated "Mon, 04 Oct 2021 13:03:15 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4004826.1633375651.1@sss.pgh.pa.us> Date: Mon, 04 Oct 2021 15:27:31 -0400 Message-ID: <4004827.1633375651@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Lewis writes: > On Mon, Oct 4, 2021, 10:30 AM Nikhil Benesch > 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