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 1nX9vb-0007P2-9c for pgsql-general@arkaria.postgresql.org; Wed, 23 Mar 2022 22:58:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nX9va-0005T0-6J for pgsql-general@arkaria.postgresql.org; Wed, 23 Mar 2022 22:58:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nX9vZ-0005Sr-SI for pgsql-general@lists.postgresql.org; Wed, 23 Mar 2022 22:58:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nX9vX-0007j9-Fs for pgsql-general@lists.postgresql.org; Wed, 23 Mar 2022 22:58:05 +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 22NMvuD22886428; Wed, 23 Mar 2022 18:57:56 -0400 From: Tom Lane To: "David G. Johnston" cc: =?UTF-8?Q?Viliam_=C4=8Eurina?= , Thomas Kellerer , "pgsql-generallists.postgresql.org" Subject: Re: Unexpected zero results In-reply-to: References: <0910192d-ed0f-e455-c591-c4d59b6172f2@gmx.net> Comments: In-reply-to "David G. Johnston" message dated "Wed, 23 Mar 2022 15:51:40 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2886426.1648076276.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Wed, 23 Mar 2022 18:57:56 -0400 Message-ID: <2886427.1648076276@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > On Wed, Mar 23, 2022 at 10:10 AM Viliam ġurina > wrote: >> Now I'm surprised that a set-returning function is even allowed in SELECT >> clause where the values have to be scalar. > AFAIK the lateral construct, which is required to avoid doing just this, is > a relatively recent invention for SQL. I infer from that fact that the > ability to execute a set-returning function in the select clause has always > been allowed. I believe that Postgres' handling of that is actually a hangover from Berkeley's PostQUEL language. Dunno what the SQL standard has to say on the subject --- but it wouldn't surprise me if they don't allow it. regards, tom lane