Skip site navigation (1) Skip section navigation (2)

Re: Ordering not acting right.

From: Mathias Stjernström <mathias(at)globalinn(dot)com>
To: PostgreSQL Admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Ordering not acting right.
Date: 2008-08-22 08:13:50
Message-ID: 774374A4-E908-4689-A290-D0A71323804D@globalinn.com (view raw or flat)
Thread:
Lists: pgsql-admin
It does not seem correct. If 'ta, a' and 'ta, b' is minor to 'tab, a'.  
you should not get that order.

This is my result and what i think is what you expect.

CREATE TABLE sorting (name varchar);

labb=# \d sorting
          Table "public.sorting"
  Column |       Type        | Modifiers
--------+-------------------+-----------
  name   | character varying |


labb=# INSERT INTO sorting VALUES('ta, a');
labb=# INSERT INTO sorting VALUES('ta, z');
labb=# INSERT INTO sorting VALUES('tab, a');


labb=# SELECT name FROM sorting ORDER BY name ASC;
   name
--------
  ta, a
  ta, z
  tab, a
(3 rows)

labb=# SELECT name FROM sorting ORDER BY name DESC;
   name
--------
  tab, a
  ta, z
  ta, a
(3 rows)

What locale do you have on that database?

Best regards,
Mathias Stjernström

http://www.pastbedti.me/




On 20 aug 2008, at 22.36, Lennin Caro wrote:

>>
>>> I have a text field which I use to store names (
>> lastname, firstname )
>>
>>> and suppose we have the following 3 authors in the
>> field:
>>>   ta, a
>>>   ta, z
>>>   tab, a
>>>
>>> I would expect them to show up in the order shown
>> above when I select
>>> this field and order it by it, but instead I get:
>>>
>>>   ta, a
>>>   tab, a
>>>   ta, z
>>>
>>> Some one has suggested that this may have to do with
>> my locale
>>> setting.
>>> I'm not an administrator so I'm not sure what
>> how to check for the
>>> locale setting or what to change it to.  Does any one
>> have any
>>> suggestions?
>>>
>>> I'm using postgres 8.1.11.
>>
>> can you show the query sintax?
>
> ok the result of the query is correct the string 'ta' is minor that  
> 'tab'
> then 'ta, a' and 'ta, b' is minor to 'tab, a'. If you split the  
> names you can order this
>
>
>
>
>
> -- 
> Sent via pgsql-admin mailing list (pgsql-admin(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin

In response to

pgsql-admin by date

Next:From: c kDate: 2008-08-22 11:13:47
Subject: LIKE and SIMILAR TO
Previous:From: Decibel!Date: 2008-08-22 05:49:23
Subject: Re: [HACKERS] [ADMIN] shared_buffers and shmmax

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group