Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjTB3-0003vu-IT for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Sep 2016 15:29:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bjTB2-0005V0-H1 for pgsql-hackers@arkaria.postgresql.org; Mon, 12 Sep 2016 15:29:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bjTB1-0005Ut-TH for pgsql-hackers@postgresql.org; Mon, 12 Sep 2016 15:29:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bjTAy-00066u-VU for pgsql-hackers@postgresql.org; Mon, 12 Sep 2016 15:29:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u8CFTbwL004005; Mon, 12 Sep 2016 11:29:37 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@postgresql.org Subject: Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) In-reply-to: <20160827214829.zo2dfb5jaikii5nw@alap3.anarazel.de> References: <20160523005327.v2tr7obytitxcnna@alap3.anarazel.de> <20160822214023.aaxz5l4igypowyri@alap3.anarazel.de> <20160827214829.zo2dfb5jaikii5nw@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sat, 27 Aug 2016 14:48:29 -0700" Date: Mon, 12 Sep 2016 11:29:37 -0400 Message-ID: <3999.1473694177@sss.pgh.pa.us> X-Pg-Spam-Score: -4.1 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andres Freund writes: > 0002-Shore-up-some-weird-corner-cases-for-targetlist-SRFs.patch > Forbid UPDATE ... SET foo = SRF() and ORDER BY / GROUP BY containing > SRFs that would change the number of returned rows. Without the > latter e.g. SELECT 1 ORDER BY generate_series(1,10); returns 10 rows. I'm on board with disallowing SRFs in UPDATE, because it produces underdetermined and unspecified results; but the other restriction seems 100% arbitrary. There is no semantic difference between SELECT a, b FROM ... ORDER BY srf(); and SELECT a, b, srf() FROM ... ORDER BY 3; except that in the first case the ordering column doesn't get returned to the client. I do not see why that's so awful that we should make it fail after twenty years of allowing it. And I certainly don't see why there would be an implementation reason why we couldn't support it anymore if we can still do the second one. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers