You are correct that you cannot change the default setting for the database; LC_COLLATE is an environment variable set on Heroku database servers that is out of your control and already set before the database was created. However, you can set the default mapping for individual columns:
CREATE TABLE new_table ( foo varchar COLLATE "sv_SE.UTF-8", bar varchar COLLATE "sv_SE.UTF-8" ); ALTER TABLE existing_table ALTER COLUMN baz TYPE varchar COLLATE "sv_SE.UTF-8";
See details in 22.2. Sorting support in the PostgreSQL manual.
You may need CREATE COLLATION . In addition, it all depends on Heroku database servers that have the correct locale data, although if they do not, you could probably ask for it to be deployed as it will not hurt anyone.
Otherwise, you could run your own PostgreSQL instances in EC2 with whatever custom setting you want. It will take investment administration time, but honestly working 9.1 is pretty simple, even including in-line replication. Perhaps even cheaper. The downside is that keeping the database running becomes your problem, not a problem for the Herocu ops team.
willglynn
source share