Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8QoN-0000i7-Ek for pgsql-docs@arkaria.postgresql.org; Tue, 27 Jul 2021 17:24:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m8QoM-0002L4-BD for pgsql-docs@arkaria.postgresql.org; Tue, 27 Jul 2021 17:24:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8QoM-0002Ku-5G for pgsql-docs@lists.postgresql.org; Tue, 27 Jul 2021 17:24:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m8QoK-0005do-4w for pgsql-docs@lists.postgresql.org; Tue, 27 Jul 2021 17:24:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 16RHO348351779; Tue, 27 Jul 2021 13:24:03 -0400 From: Tom Lane To: John Lumby cc: "pgsql-docs@lists.postgresql.org" Subject: Re: Set-Returning functions in a select list In-reply-to: References: Comments: In-reply-to John Lumby message dated "Tue, 27 Jul 2021 16:19:42 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <351777.1627406643.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 27 Jul 2021 13:24:03 -0400 Message-ID: <351778.1627406643@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk John Lumby writes: > I feel that more on this topic needs to be added to the reference inform= ation for SELECT, > both in the description of the (expressions in the) SELECT-list and in t= he description of the FROM list, and in particular a note on how and why= certain usages are equivalent when written in specific ways, (and maybe = even which is preferred). > Currently there is a thorough description of the semantics of [ LATERAL = ] ROWS FROM in the FROM list, but very little about the effect of placi= ng one or more what set-returning functions in the SELECT-list. Also = there should be a reference to the chapters under "Query Language (SQL) F= unctions" , especially sub-chapter "SQL Functions Returning Sets" The bigger picture here is that there's a lot of detail in 38.5 that is of interest to users of built-in functions, not only to people writing new functions. We've had discussions before about refactoring that material so that some of it could be moved into a more prominent place, probably in chapter 7 (Queries) or maybe chapter 9 (Functions and Operators). Nobody's produced a coherent proposal though. In the meantime I'm not much on board with sprinkling cross-references into random places, if only because those references will be pointing to the wrong place when/if this refactoring does happen. regards, tom lane