Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 08CEF632A64 for ; Fri, 16 Jul 2010 12:34:24 -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 35815-07 for ; Fri, 16 Jul 2010 15:34:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id 66F24632874 for ; Fri, 16 Jul 2010 12:34:16 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Fri, 16 Jul 2010 10:34:15 -0500 Message-Id: <4C40359E0200002500033711@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Fri, 16 Jul 2010 10:34:06 -0500 From: "Kevin Grittner" To: , "Robert Voinea" Subject: Re: Weird sorting order References: <201007161514.09960.robert.voinea@topex.ro> In-Reply-To: <201007161514.09960.robert.voinea@topex.ro> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.51 tagged_above=-10 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201007/108 X-Sequence-Number: 35127 Robert Voinea wrote: > Why is it that when running the query: > > SELECT * FROM test ORDER BY val; > > I get the following result? > id | val > ----+------- > 1 | 200 > 2 | 201 > 3 | 202 > 4 | 203 > 5 | 210 > 6 | 211 > 7 | 2##23 > 8 | 2##24 > 9 | 2##25 > 10 | 2##33 > 11 | ##26 > 12 | 2ff > 13 | ##31 > 14 | ##32 > 15 | ##34 > (15 rows) > > Shouldn't value '2ff' be placed right after '211' but before > '2##23'? That depends on your collation configuration. What do you get from?: show lc_collate; In many collations, special characters such as '#' are ignored. -Kevin