Create a gist now

Instantly share code, notes, and snippets.

Embed
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

This comment has been minimized.

Show comment
Hide comment
@diguage

diguage Feb 20, 2014

Very Good! Thank you very much!

diguage commented Feb 20, 2014

Very Good! Thank you very much!

@crmitchelmore

This comment has been minimized.

Show comment
Hide comment
@crmitchelmore

crmitchelmore Jun 9, 2014

Exactly what I needed

Exactly what I needed

@engmsaleh

This comment has been minimized.

Show comment
Hide comment
@engmsaleh

engmsaleh Jul 11, 2014

Nice one, did the trick .

Nice one, did the trick .

@kraustomasz

This comment has been minimized.

Show comment
Hide comment
@kraustomasz

kraustomasz Oct 26, 2014

Great, works!

Great, works!

@mufid

This comment has been minimized.

Show comment
Hide comment
@mufid

mufid Oct 30, 2014

It just works. Thanks!

mufid commented Oct 30, 2014

It just works. Thanks!

@clarkbremer

This comment has been minimized.

Show comment
Hide comment
@clarkbremer

clarkbremer Jul 7, 2015

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

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

@MethodenMann

This comment has been minimized.

Show comment
Hide comment
@MethodenMann

MethodenMann Oct 1, 2015

Thank you!

Thank you!

@gustavor-souza

This comment has been minimized.

Show comment
Hide comment
@gustavor-souza

gustavor-souza Oct 7, 2015

Thanks a lot.

Thanks a lot.

@macool

This comment has been minimized.

Show comment
Hide comment
@macool

macool Nov 16, 2015

awesome 😍

macool commented Nov 16, 2015

awesome 😍

@adrianmcli

This comment has been minimized.

Show comment
Hide comment
@adrianmcli

adrianmcli Dec 15, 2016

Noice!

Noice!

@Erreur32

This comment has been minimized.

Show comment
Hide comment
@Erreur32

Erreur32 Apr 5, 2017

Very Nice !

Erreur32 commented Apr 5, 2017

Very Nice !

@HNaga

This comment has been minimized.

Show comment
Hide comment
@HNaga

HNaga Sep 7, 2017

very good, thanks.

HNaga commented Sep 7, 2017

very good, thanks.

@taq

This comment has been minimized.

Show comment
Hide comment
@taq

taq May 11, 2018

Thank you!

taq commented May 11, 2018

Thank you!

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