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
