Skip to content

Instantly share code, notes, and snippets.

@sharshenov
Created March 22, 2015 06:23
Show Gist options
  • Save sharshenov/b494474ae3a0685f6a2f to your computer and use it in GitHub Desktop.
Save sharshenov/b494474ae3a0685f6a2f to your computer and use it in GitHub Desktop.
Set postgresql template1 default charset to UTF-8
# open console as postgres user
sudo -u postgres psql
# paste this
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';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment