Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)
Date
Msg-id 10998.1472827875@sss.pgh.pa.us
Whole thread Raw
In response to Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)  (Kevin Grittner <kgrittn@gmail.com>)
Responses Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)  (Kevin Grittner <kgrittn@gmail.com>)
List pgsql-hackers
Kevin Grittner <kgrittn@gmail.com> writes:
> On Fri, Sep 2, 2016 at 9:25 AM, Tom Lane <tgl@sss.pgh.pa.us> 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|               34567890123456789 |               123 |               14567890123456789 |
123|               24567890123456789 |               123 |               34567890123456789 |  4567890123456789 |
      14567890123456789 |  4567890123456789 |               24567890123456789 |  4567890123456789 |
34567890123456789| -4567890123456789 |               14567890123456789 | -4567890123456789 |
24567890123456789| -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



pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)
Next
From: Kevin Grittner
Date:
Subject: Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)