On Fri, Nov 19, 2010 at 08:33, David Fetter <da...@fetter.org> wrote: > In order to get WITH ORDINALITY, would it be better to change gram.y > to account for both WITH ORDINALITY and without, or just for the WITH > ORDINALITY case?
We probably need to change gram.y and make UNNEST to be COL_NAME_KEYWORD. UNNEST (without ORDINALITY) will call the existing unnest() function, and UNNEST() WITH ORDINALITY will call unnest_with_ordinality(). BTW, what will we return for arrays with 2 or more dimensions? There are no confusion in your two arguments version: > UNNEST(anyarray, number_of_dimensions_to_unnest) but we will also support one argument version. Array indexes will be composite numbers in the cases. The possible design would be just return sequential serial numbers of the values -- the following two queries return the same results: - SELECT i, v FROM UNNEST($1) WITH ORDINALITY AS t(v, i) - SELECT row_number() OVER () AS i, v FROM UNNEST($1) AS t(v) -- Itagaki Takahiro -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers