Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfppo-0001Mk-4i for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Sep 2016 14:52:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bfppn-0008Nv-Np for pgsql-hackers@arkaria.postgresql.org; Fri, 02 Sep 2016 14:52:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bfpoP-0005fX-Mm for pgsql-hackers@postgresql.org; Fri, 02 Sep 2016 14:51:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bfpoN-00013C-A5 for pgsql-hackers@postgresql.org; Fri, 02 Sep 2016 14:51:20 +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 u82EpF9G010999; Fri, 2 Sep 2016 10:51:15 -0400 From: Tom Lane To: Kevin Grittner cc: Andres Freund , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) In-reply-to: References: <20160523005327.v2tr7obytitxcnna@alap3.anarazel.de> <20160822214023.aaxz5l4igypowyri@alap3.anarazel.de> <20160902141110.6xciuntt5h4i6eni@alap3.anarazel.de> <20160902142023.ktgvv4ksnqinqr74@alap3.anarazel.de> <10163.1472826300@sss.pgh.pa.us> Comments: In-reply-to Kevin Grittner message dated "Fri, 02 Sep 2016 09:41:28 -0500" Date: Fri, 02 Sep 2016 10:51:15 -0400 Message-ID: <10998.1472827875@sss.pgh.pa.us> X-Pg-Spam-Score: -3.4 (---) 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 Kevin Grittner writes: > On Fri, Sep 2, 2016 at 9:25 AM, Tom Lane wrote: >> ORDER BY is not a useful suggestion when there is nothing >> you could order by to get the old behavior. > I'm apparently missing something, because I see a column with the > header "generate_series" in the result set. You are apparently only thinking about generate_series and not any other SRF. Other SRFs don't necessarily produce outputs that are in a nice sortable order. Even for one that does, sorting by it would destroy the existing behavior: regression=# select *, generate_series(1,3) from int8_tbl; q1 | q2 | generate_series ------------------+-------------------+----------------- 123 | 456 | 1 123 | 456 | 2 123 | 456 | 3 123 | 4567890123456789 | 1 123 | 4567890123456789 | 2 123 | 4567890123456789 | 3 4567890123456789 | 123 | 1 4567890123456789 | 123 | 2 4567890123456789 | 123 | 3 4567890123456789 | 4567890123456789 | 1 4567890123456789 | 4567890123456789 | 2 4567890123456789 | 4567890123456789 | 3 4567890123456789 | -4567890123456789 | 1 4567890123456789 | -4567890123456789 | 2 4567890123456789 | -4567890123456789 | 3 (15 rows) Now you could argue that the ordering of the table rows themselves is poorly defined, and you'd be right, but that doesn't change the fact that the generate_series output has a well-defined repeating sequence. People might be relying on that property. 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