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 1msW0e-0008WF-9n for pgsql-general@arkaria.postgresql.org; Wed, 01 Dec 2021 20:15:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1msW0d-00086O-54 for pgsql-general@arkaria.postgresql.org; Wed, 01 Dec 2021 20:15:19 +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 1msW0c-00086E-QM for pgsql-general@lists.postgresql.org; Wed, 01 Dec 2021 20:15:18 +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 1msW0a-0002B5-62 for pgsql-general@lists.postgresql.org; Wed, 01 Dec 2021 20:15:18 +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 1B1KF92c1991644; Wed, 1 Dec 2021 15:15:09 -0500 From: Tom Lane To: "Jenda Krynicky" cc: "pgsql-generallists.postgresql.org" Subject: Re: INSERT ... ON CONFLICT doesn't work In-reply-to: <61A7D54B.4950.34298622@Jenda.Krynicky.cz> References: <61A7CB18.20091.3401B246@Jenda.Krynicky.cz>, , <1990141.1638388378@sss.pgh.pa.us> <61A7D54B.4950.34298622@Jenda.Krynicky.cz> Comments: In-reply-to "Jenda Krynicky" message dated "Wed, 01 Dec 2021 21:04:27 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1991642.1638389709.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 01 Dec 2021 15:15:09 -0500 Message-ID: <1991643.1638389709@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Jenda Krynicky" writes: > From: Tom Lane >> It's also possible to qualify the name in the ON CONFLICT clause, >> although I think you have to parenthesize it to do so: >> ... ON CONFLICT (("Lockers"."Uuid")) > ERROR: invalid reference to FROM-clause entry for table "Lockers" > LINE 3: ON CONFLICT (("Lockers"."Uuid")) > ^ > HINT: There is an entry for table "Lockers", but it cannot be = > referenced from this part of the query. Hmm, sorry, I'd tested that in HEAD, but it seems not to work in v13. Looking closer, I think it was a not-mentioned-in-the-commit-log side-effect of [1]. Anyway, seems like you need to fall back on variable_conflict in v13. regards, tom lane [1] https://git.postgresql.org/gitweb/?p=3Dpostgresql.git&a=3Dcommitdiff&h= =3D6c0373ab7