Re: [PATCH] Proposal for HIDDEN/INVISIBLE column

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Gilles Darold <gillesdarold(at)gmail(dot)com>
Subject: Re: [PATCH] Proposal for HIDDEN/INVISIBLE column
Date: 2021-10-15 07:47:39
Message-ID: CAJ7c6TMF8f0+jchGt2wiiopapuzik6uqFAVE+epTS=k=j46VxQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

> > Just to remind here, there was recently a proposal to handle this
> > problem another way - provide a list of columns to skip for "star
> > selection" aka "SELECT * EXCEPT col1...".
> >
> > https://postgrespro.com/list/id/d51371a2-f221-1cf3-4a7d-b2242d4dafdb(at)gmail(dot)com
>
> [...]
>
> I feel using EXCEPT would be a lot clearer, no one is likely to be
> mislead into thinking that its is a security feature unlike 'HIDDEN'.
> Also you know that SELECT * will select all columns.
>
> If this kind of feature were to be added, then I'd give a +1 to use the
> EXCEPT syntax.

+1 to that, personally I would love to have SELECT * EXCEPT ... syntax
in PostgreSQL. Also, I discovered this feature was requested even
earlier, in 2007 [1]

> I don't think that the EXCEPT syntax will be adopted as it change the
> SQL syntax for SELECT in a non standard way. This is not the case of the
> hidden column feature which doesn't touch of the SELECT or INSERT syntax.

HIDDEN columns affect SELECT and INSERT behaviour in the same
non-standard way, although maybe without changing the syntax.
Personally, I believe this is even worse. The difference is that with
`SELECT * EXCEPT` you explicitly state what you want, while HIDDEN
columns do this implicitly. Extending the syntax beyond standards in a
reasonable way doesn't seem to be a problem. As a recent example in
this thread [2] the community proposed to change the syntax in
multiple places at the same time.

`SELECT * EXCEPT` solves the same problem as HIDDEN columns, but is
much easier to implement and maintain. Since it's a simple syntax
sugar it doesn't affect the rest of the system.

[1]: https://www.postgresql.org/message-id/flat/8A38B86D9187B34FA18766E261AB3AEA0D2072%40sageograma.GEO-I.local
[2]: https://www.postgresql.org/message-id/flat/CAJ7c6TPx7N-bVw0dZ1ASCDQKZJHhBYkT6w4HV1LzfS%2BUUTUfmA%40mail.gmail.com

--
Best regards,
Aleksander Alekseev

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Borisov 2021-10-15 08:01:52 Re: Partition Check not updated when insert into a partition
Previous Message Andrew Bille 2021-10-15 07:44:39 Re: [Proposal] Global temporary tables