Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Script for dealing with creating Postgres databases that complain with: ``` PG::InvalidParameterValue: ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1. ``` ...when trying to create the production DB. Taken from:…
sudo su postgres
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';

diguage commented Feb 20, 2014

Very Good! Thank you very much!

Exactly what I needed

Nice one, did the trick .

Great, works!

mufid commented Oct 30, 2014

It just works. Thanks!

Thanks, Man, that's just what I needed.

Thank you!

Thanks a lot.

macool commented Nov 16, 2015

awesome 😍


Erreur32 commented Apr 5, 2017

Very Nice !

HNaga commented Sep 7, 2017

very good, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment