Skip to content

Instantly share code, notes, and snippets.

@gouvermxt
Created May 23, 2017 20:33
Show Gist options
  • Save gouvermxt/5cecc95c1680002e41aaa0f16ece64fa to your computer and use it in GitHub Desktop.
Save gouvermxt/5cecc95c1680002e41aaa0f16ece64fa to your computer and use it in GitHub Desktop.
sudo -u postgres psql
UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
DROP DATABASE template1;
CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';
UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
\c template1
VACUUM FREEZE;
sudo /etc/init.d/postgresql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment