pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Myrta <jasiek@klaster.net>
To: Jodi Kanter <jkanter@virginia.edu>
To: Postgres SQL List <pgsql-sql@postgresql.org>
Subject: Re: order by
Date: Wed, 26 Mar 2003 19:29:14 +0800
Message-ID: <20030326192914.M43302@klaster.net> (raw)
In-Reply-To: <005501c2f3c3$43f8db30$de138f80@virginia.edu>
References: <005501c2f3c3$43f8db30$de138f80@virginia.edu>

> 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




view thread (18+ messages)  latest in thread

Message-ID: <20030326192914.M43302@klaster.net>
Permalink:  ../20030326192914.M43302@klaster.net/
Also on:    postgresql.org/message-id/20030326192914.M43302@klaster.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jasiek@klaster.net, jkanter@virginia.edu
  Subject: Re: order by
  In-Reply-To: <20030326192914.M43302@klaster.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox