Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3E58F63543A for ; Thu, 24 Jun 2010 01:50:11 -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 79654-10 for ; Thu, 24 Jun 2010 04:50:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moon.antora.ru (moon.antora.ru [89.111.189.180]) by mail.postgresql.org (Postfix) with ESMTP id 4DEA3633659 for ; Thu, 24 Jun 2010 01:50:00 -0300 (ADT) Envelope-to: pgsql-sql@postgresql.org Received: from moon.inner.space ([10.1.1.5] helo=moon.antora.ru) by moon.antora.ru with esmtp (Exim 4.67) (envelope-from ) id 1OReNw-0002oF-SM for pgsql-sql@postgresql.org; Thu, 24 Jun 2010 08:49:56 +0400 Received: from [192.168.1.6] [178.34.52.186] by moon.antora.ru (Axigen) with (DHE-RSA-AES256-SHA encrypted) ESMTPSA id 091C6E; Thu, 24 Jun 2010 08:49:56 +0400 Message-ID: <4C22E3F3.6040506@bankir.ru> Date: Thu, 24 Jun 2010 08:49:55 +0400 From: silly sad User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20100111 Thunderbird/3.0 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: ORDER BY is case insensitive References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-5 required=5 tests=BAYES_50=0.8 X-Spam-Level: X-Archive-Number: 201006/75 X-Sequence-Number: 34266 On 06/23/10 17:45, Jasen Betts wrote: > On 2010-06-22, Bryan White wrote: >> I was suprised to find out that ORDER BY is case insensitive. Is >> there a way to do a case sensitive ORDER BY clause? > > use bytea instead of a text type. > > try this: > > select * from t order by replace(f,e'\\', e'\\\\')::bytea > > you may want to index on replace(f,e'\\', e'\\\\')::bytea certainly wrong way. keyword is "multibyte chars". as he asked about case sensitivity, i presume he still want to preserve alphabet order -- u propose to cancel alphabet order at all.