On 23 July 2014 18:23, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Simon Riggs <simon@2ndQuadrant.com> writes:
>> postgres=# select * from unnest(ARRAY[1,2,3]) with ordinality;
>> unnest | ordinality
>> --------+------------
>> 1 | 1
>> 2 | 2
>> 3 | 3
>
>> postgres=# select unnest(ARRAY[1,2,3]) with ordinality;
>
>> ERROR: syntax error at or near "ordinality"
>> LINE 1: select unnest(ARRAY[1,2,3]) with ordinality;
>
> This is not a bug. The WITH ORDINALITY option is only available in FROM.
> I don't see any place in the documentation that suggests otherwise.
The phrase "The WITH ORDINALITY option is only available in FROM." is
a clear and useful statement; it isn't in the docs and should be.
Or we should have an ERROR message that says "WITH ORDINALITY may not
be used in the SELECT clause".
Perhaps both.
--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services