Skip to content

Instantly share code, notes, and snippets.

@rapimo
Created July 26, 2012 13:52
Show Gist options
  • Save rapimo/3182134 to your computer and use it in GitHub Desktop.
Save rapimo/3182134 to your computer and use it in GitHub Desktop.
change ENCODING for template1
-- Postgres makes it difficult four you to shoot yourselves in the foot
-- So it is not allowed to delete template databases
UPDATE pg_database SET datistemplate = FALSE where datname = 'template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH template = template0 encoding = 'utf8';
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