Skip to content

Instantly share code, notes, and snippets.

@EmmanuelOga
Created January 6, 2010 13:21
Show Gist options
  • Save EmmanuelOga/270268 to your computer and use it in GitHub Desktop.
Save EmmanuelOga/270268 to your computer and use it in GitHub Desktop.
change postgresql template1 db encoding to utf8 (unicode) by dropping it and recreating from template0
# change postgresql template1 db encoding to utf8 (unicode) by dropping it and recreating from template0
UPDATE pg_database SET datistemplate=false WHERE datname='template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
@ivanm
Copy link

ivanm commented Jun 13, 2012

You should add

UPDATE pg_database SET datistemplate=true WHERE datname='template1';

@tomchentw
Copy link

👍 for ivanm's

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