postgres collation differences. osx v ubuntu

后端 未结 1 811
情话喂你
情话喂你 2021-02-19 20:01

So, i\'ve recently come to realize that collation is a huge deal on postgres, and that many comments refer to OSX / locale support as \"broken\", which hasn\'t enlightened me. f

1条回答
  •  野的像风
    2021-02-19 20:19

    In the Default Unicode Collation Element Table you can see these two entries:

    002C  ; [*0220.0020.0002] # COMMA
    002D  ; [*020D.0020.0002] # HYPHEN-MINUS
    

    Here, the primary weight of COMMA is greater than the primary weight of HYPHEN-MINUS, therefore HYPHEN-MINUS sorts before COMMA.

    Note that this is the expected sort order according to the Unicode Collation Algorithm with the default weights. If you expect sort order by ASCII byte values, you get a different order. And there are other valid orders. But if the locale is named "en_US.UTF-8" (or "en_US.utf8", same thing), then you'd probably expect Unicode order. But that's between you and your operating system vendor.

    0 讨论(0)
提交回复
热议问题