Re: Unexpected behavior sorting strings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jimmy Thrasher" <jimmy(at)jimmythrasher(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Unexpected behavior sorting strings
Date: 2020-04-08 15:47:51
Message-ID: 30446.1586360871@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jimmy Thrasher" <jimmy(at)jimmythrasher(dot)com> writes:
> As I understand it, postgresql sorts strings roughly like strcmp does: character by character based on encoding value.

Only if you're using C locale. Other locales such as en_US have
completely different rules, which most hackers tend to find pretty
unintelligible and inconsistent :-(. In your example, I think
the first-pass sort is on just the letters, and only if those are
the same will it consider the punctuation.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2020-04-08 15:49:34 Re: Unexpected behavior sorting strings
Previous Message Adrian Klaver 2020-04-08 15:41:17 Re: Best method to display table information in predefined formats