On Thu, Jan 15, 2026 at 8:15 AM Christoph Berg <[email protected]> wrote:
>
> Re: Peter Eisentraut
> > => 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.
>
> Consider this example:
>
> create table t1(id int, data text, more_data text);
> create table t2(id int, other_data text, different_data text);
>
> Now if you wanted just the data without the surrogate keys, you would
> want to say:
>
> select * exclude (id) from t1 join t2 on t1.id = t2.id;
>
> Having to specify (t1.id, t2.id) would make it cumbersome to use,
> especially considering "exclude" would mostly be useful for
> interactive use.
>

A slightly different but perhaps more compelling version of this would be:

select * exclude (id) from t1 join t2 using (id);

Without the exclude, the returned row would only have a single id
column, so it seems pretty natural to similarly add an exclude for
that single id column.

Robert Treat
https://xzilla.net


Reply via email to