Re: Proposal: SELECT * EXCLUDE (...) command

From: Hunaid Sohail <hunaidpgml(at)gmail(dot)com>
To: Robert Treat <rob(at)xzilla(dot)net>
Cc: Kacper Kuras <kacperkuras(at)hotmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Christoph Berg <myon(at)debian(dot)org>
Subject: Re: Proposal: SELECT * EXCLUDE (...) command
Date: 2026-10-09 14:13:03
Message-ID: CAMWA6ya_+hRXHygMFJ6Re81YoqbX4Ni4X0mO7LRD+qDW7fXcGw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

PFA v3 of the patch.

A few notes about it:
1. This version follows the new standard syntax as mentioned in Peter's
blog along with REPLACE and RENAME clauses.

2. You might see 'star options' in code and documentation, well
that is what I am calling them collectively. This is of course open
to discussion.

3. A column specified in EXCLUDE cannot also be specified in REPLACE
or RENAME. A column may, however, be specified in both
REPLACE and RENAME.

4. The columns in the REPLACE and RENAME clauses are marked
for SELECT privilege checks, whereas the columns in the
EXCLUDE clause are not. (needs discussion)

5. No ambiguity error is raised, and operation is applied to all matching
columns in case of unqualified column names. (needs discussion)

6. Regression tests are expanded and now are now includes:
- Tests of independent clauses
- Tests of clauses in combinations
- SELECT INTO with star options
- INSERT INTO ... SELECT with star options
- RETURNING with star options is rejected, as it made no sense there.
- Error cases

7. The case: select (t2).* exclude (bar)
It comes as A_Indirection node, maybe we can reject these in gram.y
in the check_indirection function. I have not touched it yet.

Other bugs reported by Kacper are fixed in this version, and also
a few similar cases are added to regression tests as well.

I believe there is still some stuff to refactor but just wanted to show
how things are going, and gather feedback from the community.
Thanks!

Regards,
Hunaid Sohail

Attachment Content-Type Size
v3-0001-Implement-SELECT-EXCLUDE-REPLACE-RENAME-clauses.patch application/x-patch 84.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nisha Moond 2026-10-09 14:56:49 Re: Fix WITHOUT OVERLAPS multirange with location replication
Previous Message jian he 2026-10-09 13:56:16 Re: [PG19] Wrong results from NOT NULL-based expression simplification