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.94.2) (envelope-from ) id 1uudie-00EHaw-Ea for pgsql-docs@arkaria.postgresql.org; Fri, 05 Sep 2025 21:11:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uudid-00AUV8-IL for pgsql-docs@arkaria.postgresql.org; Fri, 05 Sep 2025 21:11:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uudid-00AUV0-AI for pgsql-docs@lists.postgresql.org; Fri, 05 Sep 2025 21:11:39 +0000 Received: from mail-ot1-x332.google.com ([2607:f8b0:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uudia-000m8M-0f for pgsql-docs@lists.postgresql.org; Fri, 05 Sep 2025 21:11:39 +0000 Received: by mail-ot1-x332.google.com with SMTP id 46e09a7af769-74526ca7a46so1051341a34.2 for ; Fri, 05 Sep 2025 14:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1757106694; x=1757711494; darn=lists.postgresql.org; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=8Y86BtuBt8UU5uOypw2dAWb32En+E9Ows9rzaHuyLjs=; b=KUkzWStjMjsMsywn/WlnrSN8tHO6N80kh/HW4Aoy69WzyLVy8x+n3clLVd9RECL7gw K9D9+7g4mFnSomyjx3y4pxtA/XEgcljVbyJ/J2rQKV9uh9cB62hwkhEuoH7k/n1fNyGt hxfBKZx+qLbRWJCN5YhQku+2xYeznqfu4XsmZra7mG/v4KFA6m3r2A2qzrErd12NnTDF nf1EupHtQ9Lf2LvZAQtlspO4bNUCaUeKSRf7ToE2IuOHM5nsmAIXbuCx2SiMH+vr/N5B ym03XyJhrE7dI3AUzZLYHHxq12cx5qvGNSyqrwwAIA+3p7WHPFa+6LjN355ifMb6ZZxv 3c7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757106694; x=1757711494; h=to:subject:message-id:date:from:references:in-reply-to:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8Y86BtuBt8UU5uOypw2dAWb32En+E9Ows9rzaHuyLjs=; b=LsOLTTrEM8Ej4HKzmvftCLkgmu+CR0DsNguudb4/c8CdaHD9gFCEl9IF/tsEzlynbC YcQ8NOFn5noGjgIlELPxqFjH9lynPV4kCzyN7eeixgyuzJUlMMHxwfK/CsWy7U5ae3ks uMowyog4l003iZouV0iemXkg9oxnnLEPJVdN0kD2N9bx9K6ymH1GY+U9kXdu0ERWCRB0 SYdC2kG5deMfZDJRiDid9t5b0XEmNbkDfX+pmJUATvfQwSoHesPsrMEPWCN1zTiW94p/ aUIWgEFslPMQUSUgnarb3qA369XKT65F7Q/28n8c2FIfuO5JdnhzyObY/iip0+cUeB15 yS+Q== X-Forwarded-Encrypted: i=1; AJvYcCVSgpCvaIfHipcUceD6lmzv0nhoJ+jxyVPUEsxsh0BONJd1ifeHpgDtuiiYeV+s7080nLquxF9UZcs/@lists.postgresql.org X-Gm-Message-State: AOJu0YxIAuysbkqdEiSDtqRsABuTsp17xFWjkH/fPzPKne/Q0b+j+YzT 0pfkvAJp1K7C5Kt0SrArx0tBx+F8vac1KLSJJaY7w8blk6dGDypzw70tG6q+FhHskFcKoCiBcsQ d+czJDx5m4uBFTMk4ovk+3IeL+xNzXfyIXA== X-Gm-Gg: ASbGncsf5Fs6guF1adqV6FCv71OB7zO07cewWZTJ0AmjLtkRxFrY6ev7mDZt0/NVaQq HIZSBPExPGFbl0E6677JePsfZ8ajNb2nfXzX04x/36/5GL1LieBhkgFW0zkaYXNqg7MO89Rn9Q3 ihrni97qOE6XsR0F4RuuAUQw/P2Xt39j5f+yMFyQ9JC1tXzFEd8efwtkRsIn7PVe/AgF6AwyNXT 2PZxR+SHMaaopVB X-Google-Smtp-Source: AGHT+IF7t5zw/kY3Thr8wm9iv/OA7LIUyFcU/bu/OxovpRmAT4Al7qUXdtB70tJ81AF4tVHWtTFDXnQWRtwzfZoyveU= X-Received: by 2002:a05:6808:bc8:b0:438:27fd:4422 with SMTP id 5614622812f47-43b29c752f9mr71814b6e.31.1757106694137; Fri, 05 Sep 2025 14:11:34 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6802:6184:20b0:5df:b5f6:b71 with HTTP; Fri, 5 Sep 2025 14:11:32 -0700 (PDT) In-Reply-To: <175702516430.356921.959597202664413151@wrigleys.postgresql.org> References: <175702516430.356921.959597202664413151@wrigleys.postgresql.org> From: "David G. Johnston" Date: Fri, 5 Sep 2025 14:11:32 -0700 X-Gm-Features: Ac12FXwwwzJSR02tNpCWZ31CLV_MIfz9byz5UnAfnH_qeAwfNcLH7ZrHmKVMZbc Message-ID: Subject: Re: SELECT List with/without parentheses To: "jason@starnull.net" , "pgsql-docs@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000562d99063e1448d1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000562d99063e1448d1 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thursday, September 4, 2025, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/17/sql-select.html > Description: > > Here: https://www.postgresql.org/docs/current/sql-select.html > > There is no mention of the difference in PostgreSql behavior if the selec= t > list of columns is surrounded by parentheses or not. The difference is > quite > dramatic and non-obvious, especially when working with a database driver > (like pq or pqxx) where the result is packed up in a fairly opaque object= . > Just some mention of how using parentheses causes a query to return a "ro= w" > object that represents the tuple as a single string vs not using > parentheses > where each column is represented individually. > That kind of material usually goes in the syntax chapter since it isn=E2=80= =99t special to a select command or really any command in particular. The documentation does explain that to create a row-like composite from individual columns you use [row](=E2=80=A6). https://www.postgresql.org/docs/current/sql-expressions.html#SQL-SYNTAX-ROW= -CONSTRUCTORS The select command itself states what it does: each column - and the column list is not parenthesized - becomes a column in the result. I admit it=E2=80=99s definitely not easy to try making up some new syntax, = finding that it works, then looking for the feature in the documentation from the syntax alone. But that is also not usually how one learns. In short, I=E2= =80=99m against updating =E2=80=9Cselect=E2=80=9D but would entertain some other co= ncrete suggestion since I don=E2=80=99t find this scenario rare enough to just ign= ore and deal with via Q&A. David J. --000000000000562d99063e1448d1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thursday, September 4, 2025, PG Doc comments form <noreply@postgresql.org> wrote:
The following documentation comment has been logged on= the website:

Page: https://www.postgresql.org/docs/17/sql-select.html
Description:

Here: https://www.postgresql.org/docs/current/sql-select.ht= ml

There is no mention of the difference in PostgreSql behavior if the select<= br> list of columns is surrounded by parentheses or not. The difference is quit= e
dramatic and non-obvious, especially when working with a database driver (like pq or pqxx) where the result is packed up in a fairly opaque object.<= br> Just some mention of how using parentheses causes a query to return a "= ;row"
object that represents the tuple as a single string vs not using parenthese= s
where each column is represented individually.

That kind of material usually goes in the = syntax chapter since it isn=E2=80=99t special to a select command or really= any command in particular.

The documentation does= explain that to create a row-like composite from individual columns you us= e [row](=E2=80=A6).


The select command itself states= what it does: each column - and the column list is not parenthesized - bec= omes a column in the result.

I admit it=E2=80=99s = definitely not easy to try making up some new syntax, finding that it works= , then looking for the feature in the documentation from the syntax alone.= =C2=A0 But that is also not usually how one learns.=C2=A0 In short, I=E2=80= =99m against updating =E2=80=9Cselect=E2=80=9D but would entertain some oth= er concrete suggestion since I don=E2=80=99t find this scenario rare enough= to just ignore and deal with via Q&A.

David J= .

--000000000000562d99063e1448d1--