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 1v6QLv-004Ojw-Ot for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Oct 2025 09:20:55 +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 1v6QLt-008sZj-J6 for pgsql-hackers@arkaria.postgresql.org; Wed, 08 Oct 2025 09:20:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v6QLt-008sZY-6m for pgsql-hackers@lists.postgresql.org; Wed, 08 Oct 2025 09:20:54 +0000 Received: from relay1-d.mail.gandi.net ([217.70.183.193]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1v6QLq-000dxI-2P for pgsql-hackers@postgresql.org; Wed, 08 Oct 2025 09:20:52 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id AF14C43A19; Wed, 8 Oct 2025 09:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=postgresfriends.org; s=gm1; t=1759915249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Le5xEXtKQqypRPS8IUnqbTn3zJBiGoiJIJpYAS20zu0=; b=Ju+rBTO8J6bcnlevEVLEOuYUdVGKnob5v/0MkKxw7jGvxqQY4o62Ro05hdHkCmH1gLL3GE 3b+DHtIBjYieq011euG+0v7YwvBOmDkUoCRvJcV51EZAk3OgqZIf2VWHCqzq3/ajDh59Uj +ACGvJiVu1+FaeepI8Su51t+LXdSYz9kje7Ai9hRym9G08dm5Clt7Rv+9d2I4elILiQVsh AfV9LGnN/1LLeT1T/kuQp/YdFlByOjv73Tc4jbQLWnLJ2XYXQyg041Nq+SsHK+rw1WlOwA WOBpIIN5asdj8c/hjEdE0XaxVC8nrL4Q0MNidOIK2UjGLJBEN87ekveqrEptBA== Message-ID: <1d4b3d42-ccdc-4555-b4df-268d6daf97a5@postgresfriends.org> Date: Wed, 8 Oct 2025 11:20:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values To: Dean Rasheed , Viktor Holmberg Cc: pgsql-hackers@postgresql.org References: Content-Language: en-US From: Vik Fearing In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: vik@postgresfriends.org List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 07/10/2025 23:52, Dean Rasheed wrote: > On Tue, 7 Oct 2025 at 14:56, Viktor Holmberg wrote: >> A maybe bigger question, is it nice that EXCLUDED is null when no conflict occurred? I can see the logic, but I think ergonomics wise it’d be nicer to have the proposed values in EXCLUDED, no matter what happened later. Then one can check EXCLUDED.value = NEW.value to see if one’s changes were added, for example. > Hmm, I'm not sure. I think it would be counter-intuitive to have > non-null EXCLUDED values for rows that weren't excluded, and I think > it's just as easy to check what values were added either way. Agreed.  EXCLUDED should be null or even inaccessible if the row wasn't excluded. -- Vik Fearing