Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values - Mailing list pgsql-hackers

From Jim Jones
Subject Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values
Date
Msg-id 8c0bbad5-2051-45f7-83cc-2047f7c58ba1@uni-muenster.de
Whole thread Raw
In response to Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
Hi Dean

On 30.06.25 19:18, Dean Rasheed wrote:
> v2 attached, now with docs and more test cases.

I'm wondering if the current behaviour with DEFAULT columns should be
mentioned in the docs.

CREATE TABLE t2 (a int PRIMARY KEY, b text DEFAULT 'default value');
INSERT INTO t2 VALUES (1, 'old value');

INSERT INTO t2 VALUES (1)
ON CONFLICT (a) DO UPDATE SET b = 'new value'
RETURNING a, old.b, new.b, excluded.b;
CREATE TABLE
INSERT 0 1
 a |     b     |     b     |       b       
---+-----------+-----------+---------------
 1 | old value | new value | default value
(1 row)


While it may seem intuitive, it's possible that it could cause confusion
for some users.

Best, Jim



pgsql-hackers by date:

Previous
From: Matthias van de Meent
Date:
Subject: Re: Limiting overshoot in nbtree's parallel SAOP index scans
Next
From: Arseniy Mukhin
Date:
Subject: Re: amcheck support for BRIN indexes