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

From solai v
Subject Re: Allow ON CONFLICT DO UPDATE to return EXCLUDED values
Date
Msg-id CAF0whud3pcy=pxyRkvZtTMKSKWJufpUD+geb=BUTAN01gybctQ@mail.gmail.com
Whole thread
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,

I tested the latest v6 patch and it worked well for me.
I first reproduced the current behavior on an unpatched build. As
expected, using EXCLUDED in the RETURNING clause resulted in:
ERROR: invalid reference to FROM-clause entry for table "excluded"
DETAIL: There is an entry for table "excluded", but it cannot be
referenced from this part of the query.
After applying v6-0001-Allow-EXCLUDED-in-RETURNING-list-of-INSERT-ON-CON.patch,
rebuilding PostgreSQL, and rerunning the same test, the query
completed successfully and returned the expected EXCLUDED value.
I also tried a few additional scenarios:
  RETURNING age, EXCLUDED.age
  Returning multiple EXCLUDED columns
  Using EXCLUDED in expressions (e.g. EXCLUDED.age + 10)
  Using aliases in the RETURNING list
  Testing with different data types (NUMERIC and BOOLEAN)
  Verifying that existing RETURNING behavior is unchanged
  Verifying that EXCLUDED is NULL when no conflict occurs
  Confirming that ON CONFLICT DO NOTHING behavior is unchanged

All of these behaved as expected, and I didn't encounter any issues
during testing.
Overall, the patch looks good to me.
Thanks for working on this.

Best regards,
solai



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Handle concurrent drop when doing whole database vacuum
Next
From: Shlok Kyal
Date:
Subject: Re: Support EXCEPT for ALL SEQUENCES publications