Re: Proposal: SELECT * EXCLUDE (...) command - Mailing list pgsql-hackers

From Hunaid Sohail
Subject Re: Proposal: SELECT * EXCLUDE (...) command
Date
Msg-id CAMWA6yZZ2-+Fo0Nw0mhdEZPcLi4d5f85FZ7Z9o4fP9JLdX3=Cg@mail.gmail.com
Whole thread Raw
In response to Re: Proposal: SELECT * EXCLUDE (...) command  (Peter Eisentraut <peter@eisentraut.org>)
List pgsql-hackers
Hi,

On Wed, Jan 14, 2026 at 1:28 AM Peter Eisentraut <peter@eisentraut.org> wrote:
Example 2:

=> select * exclude (bar) from t1;
ERROR:  42703: column "bar" does not exist

Example 3:

=> select * exclude (foo) from t1;
ERROR:  02000: SELECT list is empty after excluding all columns

Example 5:

=> select * exclude (bar, bar) from t2;
ERROR:  42703: column "bar" does not exist
I will handle these cases in my next patch.
 
Example 6:

=> select * exclude (foo) from t1, t2;
ERROR:  02000: SELECT list is empty after excluding all columns

My paper proposes that this should be an error because foo is ambiguous.
While implementing the patch, I thought it could be useful to allow
this when selecting from multiple tables, as EXCLUDE can be
handy in such cases (as in the example Christoph mentioned).
However, since the proposal notes that only 1 of 5 implementations
allows this and the SQL group may not go in this direction, it seems
reasonable to follow the proposal... but perhaps we can also
leave it to implementations to decide?

Example 8:

=> select * exclude (t1.foo) from t1, t2;
ERROR:  02000: SELECT list is empty after excluding all columns

Example 11:

=> select foo, t1.* exclude (foo) from t1;
ERROR:  02000: SELECT list is empty after excluding all columns
Yes, these cases should work. They seem like bugs in my patch, I will fix them.

Regards,
Hunaid Sohail

pgsql-hackers by date:

Previous
From: Andrey Borodin
Date:
Subject: Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)
Next
From: Movead
Date:
Subject: Re: Can we change pg_rewind used without wal_log_hints and data_checksums