Re: Ordering not acting right. - Mailing list pgsql-admin

From Mathias Stjernström
Subject Re: Ordering not acting right.
Date
Msg-id 774374A4-E908-4689-A290-D0A71323804D@globalinn.com
Whole thread Raw
In response to Re: Ordering not acting right.  (Lennin Caro <lennin.caro@yahoo.com>)
List 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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin


Attachment

pgsql-admin by date:

Previous
From: "kumar, Anand (Anand)"
Date:
Subject: ssl support in XA Datasource
Next
From: "c k"
Date:
Subject: LIKE and SIMILAR TO