pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Ordering not acting right.
6+ messages / 4 participants
[nested] [flat]

* Ordering not acting right.
@ 2008-08-20 19:48 Blanco, Jose <blancoj@umich.edu>
  2008-08-20 20:25 ` Re: Ordering not acting right. Lennin Caro <lennin.caro@yahoo.com>
  2008-08-20 20:31 ` Re: Ordering not acting right. Scott Marlowe <scott.marlowe@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Blanco, Jose @ 2008-08-20 19:48 UTC (permalink / raw)
  To: pgsql-admin

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.

Thank you!
Jose



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Ordering not acting right.
  2008-08-20 19:48 Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
@ 2008-08-20 20:25 ` Lennin Caro <lennin.caro@yahoo.com>
  2008-08-20 20:27   ` Re: Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
  1 sibling, 1 reply; 6+ messages in thread

From: Lennin Caro @ 2008-08-20 20:25 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org, "Blanco, Jose" <blancoj@umich.edu>

> 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?




      




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Ordering not acting right.
  2008-08-20 19:48 Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
  2008-08-20 20:25 ` Re: Ordering not acting right. Lennin Caro <lennin.caro@yahoo.com>
@ 2008-08-20 20:27   ` Blanco, Jose <blancoj@umich.edu>
  2008-08-20 20:36     ` Re: Ordering not acting right. Lennin Caro <lennin.caro@yahoo.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Blanco, Jose @ 2008-08-20 20:27 UTC (permalink / raw)
  To: lennin.caro@yahoo.com; pgsql-admin

Select name from info order by  name; 

-----Original Message-----
From: Lennin Caro [mailto:lennin.caro@yahoo.com] 
Sent: Wednesday, August 20, 2008 4:26 PM
To: pgsql-admin@postgresql.org; Blanco, Jose
Subject: Re: [ADMIN] Ordering not acting right.

> 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?




      




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Ordering not acting right.
  2008-08-20 19:48 Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
  2008-08-20 20:25 ` Re: Ordering not acting right. Lennin Caro <lennin.caro@yahoo.com>
  2008-08-20 20:27   ` Re: Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
@ 2008-08-20 20:36     ` Lennin Caro <lennin.caro@yahoo.com>
  2008-08-22 08:13       ` Re: Ordering not acting right. Mathias Stjernström <mathias@globalinn.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Lennin Caro @ 2008-08-20 20:36 UTC (permalink / raw)
  To: pgsql-admin@postgresql.org, "Blanco, Jose" <blancoj@umich.edu>

> 
> > 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


      




^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Ordering not acting right.
  2008-08-20 19:48 Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
  2008-08-20 20:25 ` Re: Ordering not acting right. Lennin Caro <lennin.caro@yahoo.com>
  2008-08-20 20:27   ` Re: Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
  2008-08-20 20:36     ` Re: Ordering not acting right. Lennin Caro <lennin.caro@yahoo.com>
@ 2008-08-22 08:13       ` Mathias Stjernström <mathias@globalinn.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Mathias Stjernström @ 2008-08-22 08:13 UTC (permalink / raw)
  To: 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

Attachments:

  PGP.sig (application/pgp-signature, 485B) download

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Ordering not acting right.
  2008-08-20 19:48 Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
@ 2008-08-20 20:31 ` Scott Marlowe <scott.marlowe@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Scott Marlowe @ 2008-08-20 20:31 UTC (permalink / raw)
  To: Blanco, Jose <blancoj@umich.edu>; +Cc: pgsql-admin

On Wed, Aug 20, 2008 at 1:48 PM, Blanco, Jose <blancoj@umich.edu> 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.

The best fix if you want ascii ordering is to re-initdb your db with
locale=C and then reload your data.

There's some stuff you can do with varchar_pattern_ops, but I'm not
sure it will work for order by in your situation.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2008-08-22 08:13 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-08-20 19:48 Ordering not acting right. Blanco, Jose <blancoj@umich.edu>
2008-08-20 20:25 ` Lennin Caro <lennin.caro@yahoo.com>
2008-08-20 20:27   ` Blanco, Jose <blancoj@umich.edu>
2008-08-20 20:36     ` Lennin Caro <lennin.caro@yahoo.com>
2008-08-22 08:13       ` Mathias Stjernström <mathias@globalinn.com>
2008-08-20 20:31 ` Scott Marlowe <scott.marlowe@gmail.com>

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