Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6945C632CA3 for ; Tue, 22 Jun 2010 17:52:32 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 80726-06 for ; Tue, 22 Jun 2010 20:52:25 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-iw0-f174.google.com (mail-iw0-f174.google.com [209.85.214.174]) by mail.postgresql.org (Postfix) with ESMTP id 25033632921 for ; Tue, 22 Jun 2010 17:52:25 -0300 (ADT) Received: by iwn38 with SMTP id 38so1274107iwn.19 for ; Tue, 22 Jun 2010 13:52:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=XLc1+ClzFaDLS5d6XcvzD2vQncSF/Y3geRfPSoc1k2I=; b=xoTDbCoDT7YzJUuEpuX1aFHxAzcm1HiAOFdeap2JE/uNuRdhIjHxKBbyKZO2I6LaDB Udl4oyc/msWTP/voUXnT7MMcbtmGfwwdP+0tLUa//+IUWvFqWxhOtlEF0K+bFlsgY8S+ fu0nwVVDvB9kqJ2JwwX85+8wnHPfc8cHTEr0c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=aRUvJ1NyaRZmp0GVguOVbDqFLJDWH993DfuksaCMPVWwbnZ2gOc0NCxcd+Xln/4EkE gqoEvTIFyCpXzY+z4MgujUMdKFGhh0FhOgKDvRUs/e1KnCAnjG36Vb4ghW+KKiFLdEWs Qp6SrCbhhEswrvtAnNoGvO83+s3lw202AGbtQ= MIME-Version: 1.0 Received: by 10.231.170.201 with SMTP id e9mr7172177ibz.119.1277239943780; Tue, 22 Jun 2010 13:52:23 -0700 (PDT) Received: by 10.231.167.10 with HTTP; Tue, 22 Jun 2010 13:52:23 -0700 (PDT) Date: Tue, 22 Jun 2010 16:52:23 -0400 Message-ID: Subject: ORDER BY is case insensitive From: Bryan White To: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.5 tagged_above=-5 required=5 tests=BAYES_05=-0.5 X-Spam-Level: X-Archive-Number: 201006/70 X-Sequence-Number: 34261 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