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 1msVKL-0005nJ-G6 for pgsql-general@arkaria.postgresql.org; Wed, 01 Dec 2021 19:31: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 1msVKJ-0001Kz-Ih for pgsql-general@arkaria.postgresql.org; Wed, 01 Dec 2021 19:31:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msVKI-0001Kk-DZ for pgsql-general@lists.postgresql.org; Wed, 01 Dec 2021 19:31:35 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1msVKF-0004YY-Aj for pgsql-general@lists.postgresql.org; Wed, 01 Dec 2021 19:31:33 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 3DB1E3200933; Wed, 1 Dec 2021 14:31:29 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 01 Dec 2021 14:31:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=k pUpnLNIDfVrNwLREq5pAzExBvVttCaHf3f4LxLXWT8=; b=J/TC4Yt22bNAcITYX LzfWlphIjTfwaLJe+l6KFiVqqL6IxZ6Jiw6Hm5tEypsClIyzXuAVl46/yktJByfM 8Dc3fYaLbfKeQBIXH01EjUC9ZnYH2HFJ3vq4sqAsM8or7rE3N2mEF/H+rn/IGj6M b/pT0qXKwMMlu32gm7Gjwq7UAJiHoXbnLxCu0F1jxh/sDgaaOyACDxhfyLTModXT aFM+OMn1NFqMPLjib8XkfCf0X4kpHwFcEBZPwcqsSzhQSSB5kvsZsyu8AGYbiPUQ 2JIb8nc3AZQ/GJsc4JiCxrPwHD7D/Lzu1WP6LQW56abBs/iccnp6IEtGI6Xe4gfg tqZzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=kpUpnLNIDfVrNwLREq5pAzExBvVttCaHf3f4LxLXW T8=; b=cHXaqMzbV2J3WfTBw0g+su0KAd0VtnZYvRbJfncZqJty5/nVaPP0RLCim iHn7dEfu0qZdSAJ2krNOZYb1xugI0JD/lr9izP/4u4dmCcC335CbCLX2rbcGhI6Z NGAwjfKO4TLZ5Gr8tDxbymagryQTIosN+jZRCqVtCkTgPqB+gs8FrT4pzr9dx8E9 ywq3UvHQv+Qe+1e3V4RW76o5F3ZcGSo2o4NzzrBjVZSo4es+9Bq5lt2/EFAzXnAq jrTnR+CxJwU4+FStVMf0M9R9PZdFylHuI+iIWm/XtZytTfVnhyH/I3je6R5oefQZ 3d7ai70f21q0OLdVoUtfpj8uHBjLg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrieefgdduvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthejredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeevteejtdeikeetfefhhffhteelvdekffevudegjeeu kefhgfdvieeliedtkeevhfenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 1 Dec 2021 14:31:27 -0500 (EST) Subject: Re: INSERT ... ON CONFLICT doesn't work To: Jenda Krynicky , pgsql-general@lists.postgresql.org References: <61A7CB18.20091.3401B246@Jenda.Krynicky.cz> From: Adrian Klaver Message-ID: Date: Wed, 1 Dec 2021 11:31:27 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <61A7CB18.20091.3401B246@Jenda.Krynicky.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/1/21 11:20 AM, Jenda Krynicky wrote: > So let's suppose I have a table like this: > > > So pretty please with a cherry on top, how do I explain to postgres > 13.4, that yes indeed by "Uuid" I mean the stinking column "Uuid". The basic issue is described here: https://www.postgresql.org/docs/current/plpgsql-implementation.html#PLPGSQL-VAR-SUBST "Since the names of variables are syntactically no different from the names of table columns, there can be ambiguity in statements that also refer to tables: is a given name meant to refer to a table column, or a variable? Let's change the previous example to ..." ERROR: column reference "Uuid" is ambiguous LINE 3: ON CONFLICT ("Uuid") Is occurring because there is ambiguity between: "Uuid" text in RETURNS TABLE and "Lockers"."Uuid" I would say the easiest way out of this is to change: "Uuid" text --> "uuid_out" text > > Jenda > -- Adrian Klaver adrian.klaver@aklaver.com