From: David G Johnston <david.g.johnston@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: Re: syntax error WITH ORDINALITY
Date: Wed, 23 Jul 2014 11:36:04 -0700 (PDT)
Message-ID: <1406140564415-5812568.post@n5.nabble.com> (raw)
In-Reply-To: <CA+U5nMLE9joz_=kafA4nc_tqmSHqW500_=vsBxzYWcUi9Ky3QA@mail.gmail.com>
References: <CA+U5nMLE9joz_=kafA4nc_tqmSHqW500_=vsBxzYWcUi9Ky3QA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: david.g.johnston@gmail.com
Subject: Re: syntax error WITH ORDINALITY
In-Reply-To: <1406140564415-5812568.post@n5.nabble.com>
References: <CA+U5nMLE9joz_=kafA4nc_tqmSHqW500_=vsBxzYWcUi9Ky3QA@mail.gmail.com> <1406140564415-5812568.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox