BUG #8243: Order by with column ordinal and collate - fails to parse - Mailing list pgsql-bugs

From tim.kane@gmail.com
Subject BUG #8243: Order by with column ordinal and collate - fails to parse
Date
Msg-id E1UpgTJ-0007Di-Qu@wrigleys.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      8243
Logged by:          Tim Kane
Email address:      tim.kane@gmail.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

pgsql-bugs by date:

Previous
From: Anand Verma
Date:
Subject: array_agg(col1 order by col2) is failing for huge amount of data
Next
From: lukina@novosoft.net
Date:
Subject: BUG #8241: submisson