Re: problem with sorting using 'ORDER BY' when character field is filled with numerical values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dragan Matic <mlists(at)panforma(dot)co(dot)yu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: problem with sorting using 'ORDER BY' when character field is filled with numerical values
Date: 2004-05-20 16:10:38
Message-ID: 1790.1085069438@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dragan Matic <mlists(at)panforma(dot)co(dot)yu> writes:
> Is there some way to make Postgres sort elements
> in this way (setting sort order or collation, I suppose)?

C locale would sort that way; you appear to be using some other locale.

I concur with the nearby suggestions that you should consider a more
appropriate datatype, if all your data will be integers. Operations on
integers will be lots faster than operations on strings.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2004-05-20 16:11:58 Re: Dblink question
Previous Message Stephan Szabo 2004-05-20 16:08:48 Re: problem with sorting using 'ORDER BY' when character