系統 - CentOS - 解決postgresql: new encoding (UTF8) ...問題



參考資訊:
https://techjourney.net/convert-postgresql-template0-template1-encoding-to-utf8-sql_ascii-incompatible/

步驟如下:

$ sudo su - postgres psql
    postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
    postgres=# \c template0
    postgres=# update pg_database set datistemplate = FALSE where datname = 'template1';
    postgres=# drop database template1;
    postgres=# create database template1 with encoding = 'UTF-8' lc_collate = 'en_US.UTF8' lc_ctype = 'en_US.UTF8' template = template0;
    postgres=# update pg_database set datistemplate = TRUE where datname = 'template1';
    postgres=# \c template1
    postgres=# update pg_database set datallowconn = FALSE where datname = 'template0';
    postgres=# \q