From: | "Jason Tiller" <jason(at)starnull(dot)net> |
---|---|
To: | pgsql-docs(at)lists(dot)postgresql(dot)org |
Subject: | Re: SELECT List with/without parentheses |
Date: | 2025-09-06 00:02:53 |
Message-ID: | 6cc77ca1-54e7-4e8d-a69e-6159fa497cb7@app.fastmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs |
Hi, Tom,
Thanks for your feedback! I'm a SQL newbie and the "implicit row constructor" syntax was an unwelcome surprise. I guess painful debugging is one way to cement a concept...
Seems like this is a nothing-burger and probably has no place in the PostgreSql documentation. Although I feel like the "principle of least surprise" has been violated here. :/
I appreciate the info!
---Jason
On Fri, Sep 5, 2025, at 2:17 PM, Tom Lane wrote:
> PG Doc comments form <noreply(at)postgresql(dot)org> writes:
>> There is no mention of the difference in PostgreSql behavior if the select
>> list of columns is surrounded by parentheses or not.
>
> What you've written there is an implicit row constructor, that is
> "(a,b,...)" is taken as "ROW(a,b,...)". These are documented at [1],
> but it would be quite unwieldy to point out the possibility of this
> for every context in which it could be written.
>
> Personally I think implicit row constructors were one of the SQL
> committee's worst ideas, precisely because of the surprise factor.
> But it's in the standard so we're stuck with it.
>
> regards, tom lane
>
> [1]
> https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS
On Fri, Sep 5, 2025, at 2:17 PM, Tom Lane wrote:
> PG Doc comments form <noreply(at)postgresql(dot)org> writes:
>> There is no mention of the difference in PostgreSql behavior if the select
>> list of columns is surrounded by parentheses or not.
>
> What you've written there is an implicit row constructor, that is
> "(a,b,...)" is taken as "ROW(a,b,...)". These are documented at [1],
> but it would be quite unwieldy to point out the possibility of this
> for every context in which it could be written.
>
> Personally I think implicit row constructors were one of the SQL
> committee's worst ideas, precisely because of the surprise factor.
> But it's in the standard so we're stuck with it.
>
> regards, tom lane
>
> [1]
> https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS
From | Date | Subject | |
---|---|---|---|
Next Message | jian he | 2025-09-07 03:02:10 | CREATE TABLE LIKE(INCLUDING COMMENTS) description ignored STATISTICS |
Previous Message | Tom Lane | 2025-09-05 21:17:02 | Re: SELECT List with/without parentheses |