I am getting different sort results for items with diacritics even though the collation being used is apparently the same.
So, after installing Postgress.app in my mac box for development I create the following table:
create table names (
id int primary key,
name varchar
)
and then insert a few values
insert into names values (1, "Francisco");
insert into names values (2, "Ana");
insert into names values (3, "Ágata");
and then query them like so:
select name from names order by name;
I get a wrong sorting order like so:
Ana
Francisco
Ágata
I can confirm with
select datname,
datcollate
from pg_database;
that the datcollate value for all databases is en_US.UTF-8.
To help me debug this problem, I quickly spinned up an RDS instance, with same data, query and collation, but this time I get the proper expected sort order of:
Ágata
Ana
Francisco
What am I missing here, and how can I configuration postgres in my dev box to behave as expected?
en_US.UTF-8, hence the title of the question of same collations (and database engines) and different sort order results. Any other ideas?