I was suprised to find out that ORDER BY is case insensitive. Is
there a way to do a case sensitive ORDER BY clause?
This transcript demonstrates what I am seeing:
$ createdb bryan
$ psql bryan
psql (8.4.4)
Type "help" for help.
bryan=# create table t (f text);
CREATE TABLE
bryan=# insert into t (f) values ('a');
INSERT 0 1
bryan=# insert into t (f) values ('b');
INSERT 0 1
bryan=# insert into t (f) values ('c');
INSERT 0 1
bryan=# insert into t (f) values ('B');
INSERT 0 1
bryan=# select * from t order by f;f
---abBc
(4 rows)
bryan=# \q
~ $ psql -l List of databases Name | Owner | Encoding | Collation |
Ctype |
Access privileges
-----------------+----------+----------+-------------+-------------+-----------------------bryan | bryan |
UTF8 | en_US.UTF-8 | en_US.UTF-8 |postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |template0
|postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
:
postgres=CTc/postgrestemplate1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
:
postgres=CTc/postgres
(4 rows)
--
Bryan White