X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 20AF9476311 for ; Wed, 26 Mar 2003 13:29:27 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 68DE4475F2C for ; Wed, 26 Mar 2003 13:29:26 -0500 (EST) Received: from lamer.pl (localhost [127.0.0.1]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 2C58C6A244; Wed, 26 Mar 2003 19:29:14 +0100 (CET) From: "Tomasz Myrta" To: Jodi Kanter , Postgres SQL List Subject: Re: order by Date: Wed, 26 Mar 2003 19:29:14 +0800 Message-Id: <20030326192914.M43302@klaster.net> In-Reply-To: <005501c2f3c3$43f8db30$de138f80@virginia.edu> References: <005501c2f3c3$43f8db30$de138f80@virginia.edu> X-Mailer: Open WebMail 1.62 20020221 X-OriginatingIP: 217.96.97.171 (jasiek) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 X-Spam-Status: No, hits=-25.9 required=5.0 tests=BAYES_01,DATE_IN_PAST_06_12,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,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/586 X-Sequence-Number: 12624 > 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. I made a test table with varchar field and filled it with your values. I got the same result as in Perl. I have Postgresql 7.3. I'm not sure what you really want to get. template1=# create table test (x varchar); template1=# insert into test values ('Study1a'); template1=# insert into test values ('Study 1b'); template1=# insert into test values ('Study 1c'); template1=# insert into test values ('Study1d'); template1=# SELECT * from test order by x asc; x ----------- Study 1c Study 1b Study1a Study1d (4 rows) Regards, Tomasz Myrta