Postgresql – Has the postgres sorting order changed between versions 11.5 and 13

postgresql

Doing a simple query to a postgres v 11.5 database yields the following results

sql select * from table order by name.;

[2021-03-09 13:27:49] testing.INFO: Hall, Hunter and Allen;;;;Hall PLC;;;;Miller, Lloyd and  

However doing the same query on the newer version 13 produces

Hall PLC;;;;;;Hall, Hunter and Allen;;;;;;Miller, Lloyd and Bailey 

I can't explain this other than what result i'm given and I can't find any more information on this matter.

Can anyone point out the change thats effected the output?

Best Answer

The sorting order for strings in PostgreSQL depends on the collation used.

This collation is taken either from the operating system C library or from the ICU library; if you didn't specify anything, it is the C library.

So if your sorting order changed, that means that your C library changed. There is no direct connection to PostgreSQL.

Note that when you upgrade the operating system C library, you should reindex all indexes on string columns to avoid data corruption.