My PostgreSQL DB appears to be using en_US.UTF-8 collation:
# SHOW lc_collate;
lc_collate
-------------
en_US.UTF-8
If I have a list of strings like: ['C - test', 'Common Scope'], and I sort them in Python, I get:
sorted(['C - test', 'Common Scope'])
['C - test', 'Common Scope']
but in Postgres, I get the opposite order:
# select * from TEST ORDER BY name;
name
--------------
Common Scope
C - test
Having Postgres sort the same way as Python does seems to be achievable by adding COLLATE "C" to the end of the select.
Is it possible to go the other way, and have Python sort strings the same was as Postgres does?