Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9XU8-0034GX-33 for pgsql-general@arkaria.postgresql.org; Mon, 28 Apr 2025 23:02:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u9XU6-003uyu-38 for pgsql-general@arkaria.postgresql.org; Mon, 28 Apr 2025 23:01:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u9XU5-003uym-On for pgsql-general@lists.postgresql.org; Mon, 28 Apr 2025 23:01:58 +0000 Received: from smtp79.iad3b.emailsrvr.com ([146.20.161.79]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u9XU4-0005I4-0a for pgsql-general@lists.postgresql.org; Mon, 28 Apr 2025 23:01:58 +0000 X-Auth-ID: xof@thebuild.com Received: by smtp10.relay.iad3b.emailsrvr.com (Authenticated sender: xof-AT-thebuild.com) with ESMTPSA id 09F3BE032C; Mon, 28 Apr 2025 19:01:53 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Re: Upsert error "column reference is ambiguous" From: Christophe Pettus In-Reply-To: Date: Mon, 28 Apr 2025 16:01:23 -0700 Cc: Tom Lane , pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <697017.1745837694@sss.pgh.pa.us> <80f95342-cc09-4236-a2d7-68538fbfc41b@wikimedia.org> <774865.1745848449@sss.pgh.pa.us> <5fe1d1c9-662e-405e-aaed-21d15bdbea06@wikimedia.org> To: Tim Starling X-Mailer: Apple Mail (2.3776.700.51.11.1) X-Classification-ID: 8406cdfb-c112-49ff-8df3-606e200983bd-1-1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Apr 28, 2025, at 15:58, Christophe Pettus wrote: > It does require knowing which of the VALUES is the key value being = inserted (pseudocode syntax above) [...] The instant after I hit send, I realized that information is available = to the function by lining up the $names and $values array, since the = name of the key column is passed in.=