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.
> Also, WITH ORDINALITY is not mentioned here...
> http://www.postgresql.org/docs/devel/static/functions-array.html
Indeed.
regards, tom lane