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

From: Robert Treat <rob(at)xzilla(dot)net>
To: Hunaid Sohail <hunaidpgml(at)gmail(dot)com>
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-06 14:49:12
Message-ID: CAJSLCQ19++VO4T1mM+t6vhCUoT_qM-pfrMNDH+cDsrXVuPjrUA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 5, 2026 at 5:39 AM Hunaid Sohail <hunaidpgml(at)gmail(dot)com> wrote:
> On Sun, Oct 4, 2026 at 12:54 AM Kacper Kuras <kacperkuras(at)hotmail(dot)com> wrote:
>>
>> I think most of this comes from matching names as strings (with
>> RangeVars from qualified_name_list). BCN-036R1 says the entries in
>> the exclude list should be resolved the same way as column
>> references in the select list. So perhaps each entry could be
>> transformed as an ordinary ColumnRef, and the star expansion could
>> then skip the columns whose Var matches, without modifying the
>> namespace item. That would give error positions and correct handling
>> of aliases and schemas for free.
>
> Thanks for reviewing the patch and reporting bugs. I already switched to
> ColumnRef in the upcoming patch since I also found similar kinds of issues.
> These issues would hopefully be fixed in the new version.
>

+1 for the review work and the framing here after such a long time away.

One thing that wasn't always clear (and hopefully the spec will answer
this better) is that while select t2.* exclude (bar) from t2; should
be supported, it isn't really clear that select (t2).* exclude (bar)
from t2; shouldn't just throw an error.

>>
>> Hunaid, are you planning to post a v3 with the standard syntax? I'd
>> be glad to test it.
>
> Sorry for the delay, I was busy with some other important stuff during
> this period. v3 is around the corner that includes support for new
> standard syntax with REPLACE and RENAME clauses.
>

No worries, I think a lot of folks are still focused on v19 related
items. Perhaps related, I suspect this might be easier to get in for
v20 if the patches work incrementally; ie. EXCLUDE first, then worry
about REPLACE and RENAME clauses. Granted that depends on the general
complexity of adding those in.

Robert Treat
https://xzilla.net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-10-06 14:49:45 Re: pgsql: Teach expr_is_nonnullable() to handle more expression types
Previous Message Tomas Vondra 2026-10-06 14:07:30 Re: hashjoins vs. Bloom filters (yet again)