BUG #8243: Order by with column ordinal and collate - fails to parse

From: tim(dot)kane(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8243: Order by with column ordinal and collate - fails to parse
Date: 2013-06-20 15:08:25
Message-ID: E1UpgTJ-0007Di-Qu@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 8243
Logged by: Tim Kane
Email address: tim(dot)kane(at)gmail(dot)com
PostgreSQL version: 9.1.9
Operating system: Debian
Description:

As per psql general mailing list thread:

http://www.postgresql.org/message-id/CADVWZZJd5veDpEi_kgzBJ3uRNuE23Zs=x=az_PewssBfmA7TSA@mail.gmail.com

The following query refuses to parse:

# select distinct(value) from properties order by 1 collate "C";
ERROR: collations are not supported by type integer
LINE 1: ... distinct(value) from properties order by 1 collate "C...
^
# select distinct(value) from properties order by distinct(value) collate
"C";
ERROR: syntax error at or near "distinct"
LINE 1: ...ct distinct(value) from properties order by distinct(v...
^
# select distinct(value) as foo from properties order by foo collate "C";
ERROR: column "foo" does not exist
LINE 1: ...tinct(value) as foo from properties order by foo collat...

The solution was as follows:

# select distinct(value) collate "C" from properties order by 1;

It's arguable if this is a bug or not, though I would have expected the
first attempt at least to be valid.

Cheers,

Tim

Browse pgsql-bugs by date

  From Date Subject
Next Message jannevelink 2013-06-20 16:47:04 BUG #8244: Stack Builder 3.1.0 fails with an http proxy because of an incorrect HTTP Host header value
Previous Message Hiroshi Saito 2013-06-20 12:35:45 Re: Re: [BUGS] Sorry to bother you. Please tell me exactly how the compiler was built ODBC