Re: syntax error WITH ORDINALITY

Поиск
Список
Период
Сортировка
От David G Johnston
Тема Re: syntax error WITH ORDINALITY
Дата
Msg-id 1406140564415-5812568.post@n5.nabble.com
обсуждение исходный текст
Ответ на syntax error WITH ORDINALITY  (Simon Riggs <simon@2ndQuadrant.com>)
Список pgsql-bugs
Simon Riggs wrote
> 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

A function used in the select-list of a query does not constitute a "table
expression" and so is not covered by this particular section of the
documentation.

From your link:

"Table functions are functions that produce a set of rows [...]. They are
used like a table, view, or subquery in the FROM clause of a query."

So even if the documentation could be improved altering this section to deal
with select-list invocations of set-returning functions seems like an
overkill and verbose solution.

David J.





--
View this message in context:
http://postgresql.1045698.n5.nabble.com/syntax-error-WITH-ORDINALITY-tp5812550p5812568.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

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

Предыдущее
От: fleminra@gmail.com
Дата:
Сообщение: BUG #11028: psql doesn't use 0x01 and 0x02 to inform readline of non-printable PROMPT1 chars
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #11028: psql doesn't use 0x01 and 0x02 to inform readline of non-printable PROMPT1 chars