Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Pavel Stehule
út 25. 2. 2020 v 22:14 odesílatel Tom Lane napsal: > Paul Jungwirth writes: > > Not that this is necessarily fatal, but you'd need to avoid parsing > > trouble with the other EXCEPT, e.g. > > SELECT 1 EXCEPT SELECT 1; > > Yeah, it doesn't sound like much consideration has been given to > that am

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Rob Sargent
> On Feb 25, 2020, at 2:14 PM, Tom Lane wrote: > > Paul Jungwirth writes: >> Not that this is necessarily fatal, but you'd need to avoid parsing >> trouble with the other EXCEPT, e.g. >> SELECT 1 EXCEPT SELECT 1; > > Yeah, it doesn't sound like much consideration has been given to > that

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Tom Lane
Paul Jungwirth writes: > Not that this is necessarily fatal, but you'd need to avoid parsing > trouble with the other EXCEPT, e.g. > SELECT 1 EXCEPT SELECT 1; Yeah, it doesn't sound like much consideration has been given to that ambiguity, but it's a big problem if you want to use a syntax like

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Paul Jungwirth
On 2/25/20 11:46 AM, Stanislav Motycka wrote: Dňa 25. 2. 2020 o 20:28 Paul A Jungwirth napísal(a): I take the proposal to mean this: SELECT listOfColumns [EXCEPT listOfColumns] FROM ... Exactly, simply exclude unneeded columns from the base clause "SELECT", nothing more .. Not that this is

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Alvaro Herrera
On 2020-Feb-25, Stanislav Motyčka 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 think an important initial question is how do other database systems implement this f

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Stanislav Motycka
Dňa 25. 2. 2020 o 20:28 Paul A Jungwirth napísal(a): I take the proposal to mean this: SELECT listOfColumns [EXCEPT listOfColumns] FROM ... Exactly, simply exclude unneeded columns from the base clause "SELECT", nothing more ..

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Guyren Howe
> On Feb 25, 2020, at 11:28 , Paul A Jungwirth > wrote: > > On Tue, Feb 25, 2020 at 2:18 AM Stanislav Motyčka > mailto:stanislav.moty...@gmail.com>> wrote: >> Sometimes (for tables with many columns) it would be better and easier to >> write "SELECT" statement with clause "EXCEPT": >> "SELECT

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Paul A Jungwirth
On Tue, Feb 25, 2020 at 2:18 AM Stanislav Motyčka 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 i

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Miles Elam
On Tue, Feb 25, 2020 at 6:41 AM Josef Šimánek wrote: > > út 25. 2. 2020 v 15:35 odesílatel Miles Elam > napsal: > >> How do you see this syntax working in a JOIN query? >> >> SELECT x.* EXCEPT x.col1, x.col2, y.col1 >> FROM tablex AS x >> LEFT JOIN tabley AS y; >> >> The column(s) you want to

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Josef Šimánek
út 25. 2. 2020 v 15:35 odesílatel Miles Elam napsal: > How do you see this syntax working in a JOIN query? > > SELECT x.* EXCEPT x.col1, x.col2, y.col1 > FROM tablex AS x > LEFT JOIN tabley AS y; > > The column(s) you want to exclude become ambiguous. > Can you explain how are those column(s)

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Miles Elam
How do you see this syntax working in a JOIN query? SELECT x.* EXCEPT x.col1, x.col2, y.col1 FROM tablex AS x LEFT JOIN tabley AS y; The column(s) you want to exclude become ambiguous. Parentheses? SELECT x.* EXCEPT (x.col1, x.col2), y.col1 FROM tablex AS x LEFT JOIN tabley AS y; Could work

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Fabio Ugo Venchiarutti
That makes sense, however for my general use case I'd also like the ability to mark some columns as not match-able by `SELECT * FROM ` and `TABLE ` at table definition without having to create dedicated views (think of the way system attributes such as tableoid, cmax, cmin ... are handled) .

Re: a proposal for a new functionality: "SELECT * [EXCEPT col1 [,col2]]

2020-02-25 Thread Josef Šimánek
Just to mention, similar concept can be found in Google BigQuery. https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select-except https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select-replace út 25. 2. 2020 v 11:18 odesílatel Stanislav Motyčka