From: Daniel Verite <daniel@manitou-mail.org>
To: Peter J. Holzer <hjp-pgsql@hjp.at>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Can we go beyond the standard to make Postgres radically better?
Date: Fri, 11 Feb 2022 14:35:33 +0100
Message-ID: <2acec54b-4491-4f5a-aa48-4d4cda72b302@manitou-mail.org> (raw)
In-Reply-To: <20220210172545.f7vtdcrg325v3xlx@hjp.at>
Peter J. Holzer wrote:
> > My use case for such a feature are tables which contain one column (or a
> > small number of columns) which you usually don't want to select: A bytea
> > column or a very wide text column. In a program I don't mind (in fact I
> > prefer) listing all the columns explicitely, but exploring a database
> > interactively with psql typing lots of column names is tedious
> > (especially since autocomplete doesn't work here).
>
> Forgot to add: I think that the syntax would have to be more explicit.
> It's too easy to mix up
> SELECT * - b.a_id FROM ...
> and
> SELECT *, - b.a_id FROM ...
>
> Maybe
> SELECT * EXCEPT b.a_id FROM ...
The solution to this by the SQL standard might be that it can be done with
a Polymorphic Table Function, introduced in SQL:2016.
https://webstore.iec.ch/preview/info_isoiec19075-7%7Bed1.0%7Den.pdf
A practical example with the Oracle implementation can be seen here:
https://blogs.oracle.com/sql/post/select-star-except-queries-in-oracle-database
Excluding all columns of a given type from a relation is also possible,
with both the relation and the type as parameters of the PTF.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: daniel@manitou-mail.org, hjp-pgsql@hjp.at
Subject: Re: Can we go beyond the standard to make Postgres radically better?
In-Reply-To: <2acec54b-4491-4f5a-aa48-4d4cda72b302@manitou-mail.org>
References: <20220210172545.f7vtdcrg325v3xlx@hjp.at> <2acec54b-4491-4f5a-aa48-4d4cda72b302@manitou-mail.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox