Re: BUG #16789: Wrong order by output

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pmanousis(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16789: Wrong order by output
Date: 2020-12-22 21:50:51
Message-ID: 662062.1608673851@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> I don't know if there is anything specific to do for having a proper ordered
> output, but the result seems wrong to me.

You need to use a locale (collation) that matches your expectations.

FWIW, I get the same ordering you show with COLLATE "en_US" on a
Linux box, and it's likely that glibc would use similar ordering
rules for some other languages. The behavior you say you want
looks like it'd match COLLATE "C", though that might act a little
funny with non-ASCII characters.

(I'm not here to defend glibc's sorting rules, but I think what
they're doing in this example is ignoring spaces in the first pass.)

You can find more about this topic in

https://www.postgresql.org/docs/current/charset.html

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Zhiyu ZY13 Xu 2020-12-23 02:46:49 答复: [External] Re: pgadmin--pgagent---the process hang by unknow reasons
Previous Message Першин Юрий Петрович 2020-12-22 20:18:45 RE: BUG #16787: ODBC driver (libpq.dll, psqlodbc30a.dll, psqlodbc30w.dll) issues