Re: Unexpected behavior sorting strings

2020-04-08 Thread Jimmy Thrasher
Many thanks! That clarifies things well. Jimmy On Wed, Apr 8, 2020, at 11:49 AM, Adrian Klaver wrote: > On 4/8/20 7:35 AM, Jimmy Thrasher wrote: > > Am I missing something about how sorting works? > > I believe you are looking for 'C' collation: > > test=# select unnest(array[('> N' collate "C

Re: Unexpected behavior sorting strings

2020-04-08 Thread Adrian Klaver
On 4/8/20 7:35 AM, Jimmy Thrasher wrote: I'm seeing some unexpected behavior when sorting some strings, and it indicates I don't fully understand how postgresql string sorting works. As I understand it, postgresql sorts strings roughly like strcmp does: character by character based on encoding

Re: Unexpected behavior sorting strings

2020-04-08 Thread Tom Lane
"Jimmy Thrasher" 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 a

Unexpected behavior sorting strings

2020-04-08 Thread Jimmy Thrasher
I'm seeing some unexpected behavior when sorting some strings, and it indicates I don't fully understand how postgresql string sorting works. As I understand it, postgresql sorts strings roughly like strcmp does: character by character based on encoding value. In particular, I'm seeing the foll