pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryan White <nicktook@gmail.com>
To: pgsql-sql@postgresql.org
Subject: ORDER BY is case insensitive
Date: Tue, 22 Jun 2010 16:52:23 -0400
Message-ID: <AANLkTimupyTgU-h-LKkV9VprzFopMMBKqsoO2RVpAzgL@mail.gmail.com> (raw)

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
---
 a
 b
 B
 c
(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/postgres
 template1       | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
                                                                   :
postgres=CTc/postgres
(4 rows)



-- 
Bryan White



view thread (6+ messages)  latest in thread

Message-ID: <AANLkTimupyTgU-h-LKkV9VprzFopMMBKqsoO2RVpAzgL@mail.gmail.com>
Permalink:  ../AANLkTimupyTgU-h-LKkV9VprzFopMMBKqsoO2RVpAzgL@mail.gmail.com/
Also on:    postgresql.org/message-id/AANLkTimupyTgU-h-LKkV9VprzFopMMBKqsoO2RVpAzgL@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: nicktook@gmail.com
  Subject: Re: ORDER BY is case insensitive
  In-Reply-To: <AANLkTimupyTgU-h-LKkV9VprzFopMMBKqsoO2RVpAzgL@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox