From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kevin Grittner <kgrittn@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)
Date: Fri, 02 Sep 2016 10:51:15 -0400
Message-ID: <10998.1472827875@sss.pgh.pa.us> (raw)
In-Reply-To: <CACjxUsNrhn5CMk25qsGnx-G6_AAkddQSa=k3g_DFVhb2D1-aSQ@mail.gmail.com>
References: <20160523005327.v2tr7obytitxcnna@alap3.anarazel.de>
<20160822214023.aaxz5l4igypowyri@alap3.anarazel.de>
<CA+TgmoboLaUy71iLKa2GPcnioWmNxhCFdcDj-F05sZOGgRO0NA@mail.gmail.com>
<CACjxUsM7PUBF3_u-+J7j1WsoRZ9OVNTw2+=P15t2pqnv7utktQ@mail.gmail.com>
<20160902141110.6xciuntt5h4i6eni@alap3.anarazel.de>
<20160902142023.ktgvv4ksnqinqr74@alap3.anarazel.de>
<10163.1472826300@sss.pgh.pa.us>
<CACjxUsNrhn5CMk25qsGnx-G6_AAkddQSa=k3g_DFVhb2D1-aSQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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 | 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, kgrittn@gmail.com, andres@anarazel.de, robertmhaas@gmail.com
Subject: Re: Implement targetlist SRFs using ROWS FROM() (was Changed SRF in targetlist handling)
In-Reply-To: <10998.1472827875@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox