From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Kevin Grittner <kgrittn(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) |
Date: | 2016-09-02 14:51:15 |
Message-ID: | 10998.1472827875@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Kevin Grittner <kgrittn(at)gmail(dot)com> writes:
> On Fri, Sep 2, 2016 at 9:25 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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 | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2016-09-02 15:01:39 | Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) |
Previous Message | Kevin Grittner | 2016-09-02 14:41:28 | Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling) |