Re: syntax error WITH ORDINALITY - Mailing list pgsql-bugs

From Simon Riggs
Subject Re: syntax error WITH ORDINALITY
Date
Msg-id CA+U5nMJjOc8j+VKN5bMsya6ErazXM1OVcpaeyWKGzwCwo34ufQ@mail.gmail.com
Whole thread Raw
In response to Re: syntax error WITH ORDINALITY  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #11028: psql doesn't use 0x01 and 0x02 to inform readline of non-printable PROMPT1 chars
Next
From: PatilChandakantK@Gmail.com
Date:
Subject: BUG #11024: Exported CSV name is not correct.