| From: | Hunaid Sohail <hunaidpgml(at)gmail(dot)com> |
|---|---|
| To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
| Cc: | pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Proposal: SELECT * EXCLUDE (...) command |
| Date: | 2026-01-16 13:14:56 |
| Message-ID: | CAMWA6yZZ2-+Fo0Nw0mhdEZPcLi4d5f85FZ7Z9o4fP9JLdX3=Cg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On Wed, Jan 14, 2026 at 1:28 AM Peter Eisentraut <peter(at)eisentraut(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Movead | 2026-01-16 13:28:28 | Re: Can we change pg_rewind used without wal_log_hints and data_checksums |
| Previous Message | Andrey Borodin | 2026-01-16 13:05:44 | Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access) |