Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]] - Mailing list pgsql-general

From Paul A Jungwirth
Subject Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]
Date
Msg-id CA+renyWW_wjY7Qsis6fHJL_VQj=274aRD2Tb-k_QYe=aNwEing@mail.gmail.com
Whole thread Raw
In response to Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]  (Miles Elam <miles.elam@productops.com>)
Responses Re: a proposal for a new functionality: "SELECT * [EXCEPT col1[,col2]]  (Guyren Howe <guyren@gmail.com>)
Re: a proposal for a new functionality: "SELECT * [EXCEPT col1[,col2]]  (Stanislav Motycka <stanislav.motycka@gmail.com>)
List pgsql-general
On Tue, Feb 25, 2020 at 2:18 AM Stanislav Motyčka
<stanislav.motycka@gmail.com> wrote:
> Sometimes (for tables with many columns) it would be better and easier to write "SELECT" statement with clause
"EXCEPT":
> "SELECT * [EXCEPT col1 [,col2]] FROM ..."

I've wanted this feature lots of times and would be delighted to see
it in Postgres.

On Tue, Feb 25, 2020 at 6:51 AM Miles Elam <miles.elam@productops.com> wrote:
> Do you mean
>   "select everything from tablex except for tablex.col1, and also select tablex.col2 and tabley.col1"
> or
>   "select everything from tablex except for tablex.col1 AND tablex.col2, and also select tabley.col1"
> ?

I take the proposal to mean this:

SELECT listOfColumns [EXCEPT listOfColumns] FROM ...

not this:

SELECT listOfColumns [EXCEPT (listOfColumns) [listOfColumns [EXCEPT
(listOfColumns)]]]... FROM ...

So there is always a single EXCEPT clause (if any) and it comes after
the entire SELECT clause. Then there is no ambiguity. Also this
approach makes the feature easy to understand and use. I don't see any
benefit to letting people interleave selected & excepted columns.

Regards,
Paul



pgsql-general by date:

Previous
From: Dipanjan Ganguly
Date:
Subject: Re: Connections dropping while using Postgres backend DB with Ejabberd
Next
From: Justin
Date:
Subject: Re: Connections dropping while using Postgres backend DB with Ejabberd