From: | Greg Stark <stark(at)mit(dot)edu> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Review: UNNEST (and other functions) WITH ORDINALITY |
Date: | 2013-07-19 17:50:10 |
Message-ID: | CAM-w4HOnJ2t2SpaN1eE6oDa9YdiVDmuUT7eqbUNe92FC4YfCxw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | Postg범퍼카 토토SQL |
On Wed, Jun 26, 2013 at 2:47 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Some of the rest of us would like to hear those reasons, because my
> immediate reaction is that the patch must be broken by design. WITH
> ORDINALITY should not be needing to mess with the fundamental evaluation
> semantics of SRFs, but it sure sounds like it is doing so if that case
> doesn't work as expected.
As Dan pointed out later the patch is not affecting whether this case
works as expected. Only that since you can only use WITH ORDINALITY on
SRFs in the FROM list and not in the target list if you want to use it
you have to rewrite this query to put the SRFs in the FROM list.
I think we're ok with that since SRFs in the target list are something
that already work kind of strangely and probably we would rather get
rid of rather than work to extend. It would be hard to work ordinality
into the grammar in the middle of the target list let alone figure out
how to implement it.
My only reservation with this patch is whether the WITH_ORDINALITY
parser hack is the way we want to go. The precedent was already set
with WITH TIME ZONE though and I think this was the best option. The
worst failure I can come up with is this which doesn't seem like a
huge problem:
postgres=# with o as (select 1 ) select * from o;
?column?
----------
1
(1 row)
postgres=# with ordinality as (select 1 ) select * from ordinality;
ERROR: syntax error at or near "ordinality"
LINE 1: with ordinality as (select 1 ) select * from ordinality;
^
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2013-07-19 18:15:53 | Re: FKey not enforced resulting in broken Dump/Reload |
Previous Message | David Fetter | 2013-07-19 17:46:11 | Re: Foreign Tables as Partitions |