public inbox for [email protected]
help / color / mirror / Atom feedremark regarding 4.2.13. Row Constructors
3+ messages / 3 participants
[nested] [flat]
* remark regarding 4.2.13. Row Constructors
@ 2026-06-08 07:42 PG Doc comments form <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: PG Doc comments form @ 2026-06-08 07:42 UTC (permalink / raw)
To: [email protected]; +Cc: [email protected]
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/18/sql-expressions.html
Description:
Hi,
in
https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS
there is:
"The key word ROW is optional when there is more than one expression in the
list."
I think it should be:
"The key word ROW is optional when there are more than zero expressions in
the list."
Test Case:
[postgres@lin5 ~]$ psql mydb
psql (19beta1)
Type "help" for help.
mydb=# select (1);
?column?
----------
1
(1 row)
mydb=# select (1,2);
row
-------
(1,2)
(1 row)
mydb=# select ();
ERROR: syntax error at or near ")"
LINE 1: select ();
^
mydb=# select row();
row
-----
()
(1 row)
mydb=#
Regards
Jochen
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: remark regarding 4.2.13. Row Constructors
@ 2026-06-09 08:06 Daniel Gustafsson <[email protected]>
parent: PG Doc comments form <[email protected]>
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Gustafsson @ 2026-06-09 08:06 UTC (permalink / raw)
To: [email protected]; PostgreSQL-documentation <[email protected]>
> On 8 Jun 2026, at 09:42, PG Doc comments form <[email protected]> wrote:
> in
> https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS
> there is:
> "The key word ROW is optional when there is more than one expression in the
> list."
> I think it should be:
> "The key word ROW is optional when there are more than zero expressions in
> the list."
"more than zero" sounds a bit odd, my suggestion would be "The key word ROW is
optional when there is one, or more, expressions in the list."
--
Daniel Gustafsson
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: remark regarding 4.2.13. Row Constructors
@ 2026-06-09 16:46 Tom Lane <[email protected]>
parent: Daniel Gustafsson <[email protected]>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2026-06-09 16:46 UTC (permalink / raw)
To: Daniel Gustafsson <[email protected]>; +Cc: [email protected]; PostgreSQL-documentation <[email protected]>
Daniel Gustafsson <[email protected]> writes:
>> On 8 Jun 2026, at 09:42, PG Doc comments form <[email protected]> wrote:
>> in
>> https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS
>> there is:
>> "The key word ROW is optional when there is more than one expression in the
>> list."
>> I think it should be:
>> "The key word ROW is optional when there are more than zero expressions in
>> the list."
> "more than zero" sounds a bit odd, my suggestion would be "The key word ROW is
> optional when there is one, or more, expressions in the list."
More to the point, the statement is correct as written and either of
these changes would make it wrong. For example, both of these things
produce a two-column composite value:
postgres=# select row(1,2), (1,2);
row | row
-------+-------
(1,2) | (1,2)
(1 row)
postgres=# select pg_typeof(row(1,2)), pg_typeof((1,2));
pg_typeof | pg_typeof
-----------+-----------
record | record
(1 row)
But adding more parentheses around a scalar value does not make
it a composite value:
postgres=# select row(1), (1), ((((1))));
row | ?column? | ?column?
-----+----------+----------
(1) | 1 | 1
(1 row)
postgres=# select pg_typeof(row(1)), pg_typeof((1)), pg_typeof(((((1)))));
pg_typeof | pg_typeof | pg_typeof
-----------+-----------+-----------
record | integer | integer
(1 row)
Maybe there is something we can do to make this clearer, but
the above isn't it.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-06-09 16:46 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-08 07:42 remark regarding 4.2.13. Row Constructors PG Doc comments form <[email protected]>
2026-06-09 08:06 ` Daniel Gustafsson <[email protected]>
2026-06-09 16:46 ` Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox