X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 085E5475F00 for ; Wed, 26 Mar 2003 13:44:39 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 6D20E475CBC for ; Wed, 26 Mar 2003 13:44:34 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 36C35D5FA; Wed, 26 Mar 2003 10:44:34 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 2C7C55C0C; Wed, 26 Mar 2003 10:44:34 -0800 (PST) Date: Wed, 26 Mar 2003 10:44:33 -0800 (PST) From: Stephan Szabo To: Jodi Kanter Cc: Postgres SQL List Subject: Re: order by In-Reply-To: <005501c2f3c3$43f8db30$de138f80@virginia.edu> Message-ID: <20030326104353.P63544-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-25.8 required=5.0 tests=BAYES_00,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/587 X-Sequence-Number: 12625 On Wed, 26 Mar 2003, Jodi Kanter wrote: > Is there a known problem with the SQL order by clause within postgres > version 7.2.3? I am trying to sort a field which holds file names that > have some spaces as well non-alphanumeric characters, including > underscores (see below). > > The results of: > select study_name from study order by study_name; > > > Study1a > Study 1b > Study 1c > Study1d > > > The results of sorting in Perl (which uses Linux's underlying sort function) > > Study 1c > Study 1b > Study1a > Study1d > > Is there any way around this difference? Blank spaces should show up > first in the sort. Are you in "C" locale or something like "en_US"? In the latter, the first is the "correct" ordering.