Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wWzbH-002zYc-2m for pgsql-docs@arkaria.postgresql.org; Tue, 09 Jun 2026 16:46:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wWzbF-007iXY-2d for pgsql-docs@arkaria.postgresql.org; Tue, 09 Jun 2026 16:46:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wWzbF-007iXQ-1v for pgsql-docs@lists.postgresql.org; Tue, 09 Jun 2026 16:46:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wWzbD-00000001sWI-2lFX for pgsql-docs@lists.postgresql.org; Tue, 09 Jun 2026 16:46:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 659Gkca2891849; Tue, 9 Jun 2026 12:46:38 -0400 From: Tom Lane To: Daniel Gustafsson cc: jochen.bandhauer@gmx.net, PostgreSQL-documentation Subject: Re: remark regarding 4.2.13. Row Constructors In-reply-to: <8B3166A3-E46D-4A21-B755-37301A6102AF@yesql.se> References: <178090456543.1285959.7355583344220664853@wrigleys.postgresql.org> <8B3166A3-E46D-4A21-B755-37301A6102AF@yesql.se> Comments: In-reply-to Daniel Gustafsson message dated "Tue, 09 Jun 2026 10:06:20 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <891847.1781023598.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 09 Jun 2026 12:46:38 -0400 Message-ID: <891848.1781023598@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Daniel Gustafsson writes: >> On 8 Jun 2026, at 09:42, PG Doc comments form = 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=3D# select row(1,2), (1,2); row | row = -------+------- (1,2) | (1,2) (1 row) postgres=3D# 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=3D# select row(1), (1), ((((1)))); row | ?column? | ?column? = -----+----------+---------- (1) | 1 | 1 (1 row) postgres=3D# 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