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 1m7K7y-0000PS-Bg for pgsql-general@arkaria.postgresql.org; Sat, 24 Jul 2021 16:03:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m7K7x-0007bx-BH for pgsql-general@arkaria.postgresql.org; Sat, 24 Jul 2021 16:03:49 +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 1m7K7x-0007bp-2V for pgsql-general@lists.postgresql.org; Sat, 24 Jul 2021 16:03:49 +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 1m7K7u-0005eO-9a for pgsql-general@postgresql.org; Sat, 24 Jul 2021 16:03:48 +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 16OG3gBM1163941; Sat, 24 Jul 2021 12:03:42 -0400 From: Tom Lane To: J Lumby cc: pgsql-general@postgresql.org Subject: Re: Set-Returning functions in a select list In-reply-to: References: <159567011970.625.15282665367468168691@wrigleys.postgresql.org> <673790.1595689577@sss.pgh.pa.us> Comments: In-reply-to J Lumby message dated "Sat, 24 Jul 2021 11:52:23 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1163939.1627142622.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 24 Jul 2021 12:03:42 -0400 Message-ID: <1163940.1627142622@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk J Lumby writes: > I am unclear about the rules which postgresql uses in building a result = > set when the select list ( see note ) contains several different = > Set-Returning functions,=C2=A0 possibly with sets of different sizes. The docs you want exist, but they're a bit buried ... see https://www.postgresql.org/docs/current/xfunc-sql.html#XFUNC-SQL-FUNCTIONS= -RETURNING-SET In particular, the NOTE at the bottom of that section explains that the behavior changed in v10. regards, tom lane