Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id DF7B8632489 for ; Tue, 22 Jun 2010 18:40:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 03506-07 for ; Tue, 22 Jun 2010 21:40:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D5AC46322FB for ; Tue, 22 Jun 2010 18:40:03 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o5MLe14A008427; Tue, 22 Jun 2010 17:40:01 -0400 (EDT) To: Bryan White cc: pgsql-sql@postgresql.org Subject: Re: ORDER BY is case insensitive In-reply-to: References: Comments: In-reply-to Bryan White message dated "Tue, 22 Jun 2010 16:52:23 -0400" Date: Tue, 22 Jun 2010 17:40:01 -0400 Message-ID: <8426.1277242801@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/72 X-Sequence-Number: 34263 Bryan White writes: > I was suprised to find out that ORDER BY is case insensitive. Is > there a way to do a case sensitive ORDER BY clause? Text sort order is determined by the rules of the locale you're using, specifically the database's LC_COLLATE setting. Most implementations of en_US locale use "dictionary" ordering. You might prefer C locale's rules instead. regards, tom lane