Skip to content

Instantly share code, notes, and snippets.

@turboladen
Created October 2, 2013 08:46
Show Gist options
  • Star 73 You must be signed in to star a gist
  • Fork 19 You must be signed in to fork a gist
  • Save turboladen/6790847 to your computer and use it in GitHub Desktop.
Save turboladen/6790847 to your computer and use it in GitHub Desktop.
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: http://stackoverflow.com/questions/13115692/encoding-utf8-does-not-match-…
sudo su postgres
psql
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
Copy link

diguage commented Feb 20, 2014

Very Good! Thank you very much!

@crmitchelmore
Copy link

Exactly what I needed

@engmsaleh
Copy link

Nice one, did the trick .

@kraustomasz
Copy link

Great, works!

@mufid
Copy link

mufid commented Oct 30, 2014

It just works. Thanks!

@clarkbremer
Copy link

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

@MethodenMann
Copy link

Thank you!

@gustavor-souza
Copy link

Thanks a lot.

@macool
Copy link

macool commented Nov 16, 2015

awesome 😍

@adrianmcli
Copy link

Noice!

@Erreur32
Copy link

Erreur32 commented Apr 5, 2017

Very Nice !

@HNaga
Copy link

HNaga commented Sep 7, 2017

very good, thanks.

@taq
Copy link

taq commented May 11, 2018

Thank you!

@agguro
Copy link

agguro commented Oct 24, 2018

A Huge time saver for me. Thanks a lot!!!!!!!!!!!

@cgonzalezdai
Copy link

save my day. thx!!

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