Re: syntax error WITH ORDINALITY

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: syntax error WITH ORDINALITY
Date: 2014-07-23 19:46:52
Message-ID: CA+U5nMJjOc8j+VKN5bMsya6ErazXM1OVcpaeyWKGzwCwo34ufQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 23 July 2014 18:23, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Simon Riggs <simon(at)2ndQuadrant(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-07-23 20:48:51 Re: BUG #11025: could not access status of transaction 7
Previous Message Tom Lane 2014-07-23 19:12:47 Re: BUG #11028: psql doesn't use 0x01 and 0x02 to inform readline of non-printable PROMPT1 chars