syntax error WITH ORDINALITY

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: syntax error WITH ORDINALITY
Date: 2014-07-23 17:12:16
Message-ID: CA+U5nMLE9joz_=kafA4nc_tqmSHqW500_=vsBxzYWcUi9Ky3QA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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;

though this works

postgres=# select unnest(ARRAY[1,2,3]);

unnest
--------
1
2
3

The manual
http://www.postgresql.org/docs/devel/static/queries-table-expressions.html#QUERIES-TABLEFUNCTIONS
says
"Columns returned by table functions can be included in SELECT, JOIN,
or WHERE clauses in the same manner as columns of a table, view, or
subquery."
There is no qualification of that for WITH ORDINALITY, nor an example

So either the manual is wrong, or the syntax is.

Also, WITH ORDINALITY is not mentioned here...
http://www.postgresql.org/docs/devel/static/functions-array.html

--
Simon Riggs http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-07-23 17:23:32 Re: syntax error WITH ORDINALITY
Previous Message Marti Raudsepp 2014-07-23 08:17:32 Re: BUG #10972: string_agg function incorrectly concatenating varying delimiter