Re: Review: UNNEST (and other functions) WITH ORDINALITY

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Review: UNNEST (and other functions) WITH ORDINALITY
Дата
Msg-id CAM-w4HOnJ2t2SpaN1eE6oDa9YdiVDmuUT7eqbUNe92FC4YfCxw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Review: UNNEST (and other functions) WITH ORDINALITY  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Review: UNNEST (and other functions) WITH ORDINALITY  (Greg Stark <stark@mit.edu>)
Re: Review: UNNEST (and other functions) WITH ORDINALITY  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Wed, Jun 26, 2013 at 2:47 AM, Tom Lane <tgl@sss.pgh.pa.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Foreign Tables as Partitions
Следующее
От: Robert Haas
Дата:
Сообщение: Re: FKey not enforced resulting in broken Dump/Reload