postgres change deafult encode 1

postgres change deafult encode

postgres@yourserver:~$ psql


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';
\c template1;
VACUUM FREEZE;

Here is what the above code is Doing:
1. Connect to the database server
2. Set the template1 database to not be a template
3. Drop the template1 database
4. Create a new template1 database with the template0 database as a template
5. Set the template1 database to be a template
6. Connect to the template1 database
7. Freeze the template1 database

Similar Posts