Обсуждение: Bug #577: incorect sort using order by

Поиск
Список
Период
Сортировка

Bug #577: incorect sort using order by

От
pgsql-bugs@postgresql.org
Дата:
Christophe RIMBAUD (christophe.rimbaud@bull.net) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
incorect sort using order by

Long Description
I have a problem with the order by command.
The column is in CHAR,
for example :
table WAPI (wapinom CHAR(6));

select wapinom from wapi order by wapinom ;
 wapinom
----------
 ACTI-ACC
 ACTI-CRE
 ACTIGINT
 ACTI-MOD
 ACTI-SUP
 ACTU-CRE
 ACTUGINT
 ACTU-INL

my question : why 'ACTIGINT' is after 'ACTI-CRE'. Under Oracle 'ACTIGINT' is after 'ACTI-SUP' that's better.
I'm about to transform a big piece of oracle code to postgres and this bug is very annoyance for me .

Thanks in advance

Chris


Sample Code


No file was uploaded with this report

Re: Bug #577: incorect sort using order by

От
Tom Lane
Дата:
pgsql-bugs@postgresql.org writes:
> my question : why 'ACTIGINT' is after 'ACTI-CRE'. Under Oracle
> 'ACTIGINT' is after 'ACTI-SUP' that's better.

If you think that, you should be using C locale not whatever you are
using (perhaps en-US locale).  Postgres sorts according to the rules
of the locale that the database was initialized in.

Unfortunately, you'll have to re-initdb to change the locale setting.

            regards, tom lane