new encoding (UTF8) is incompatible

Please follow the steps below to sought the above postgresql error

We need to drop or modify template1. Templates can’t be dropped, hence we need to make make an database:

su postgres

psql

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

Now we can drop it:

DROP DATABASE template1;

Create database from template0, with a new default encoding:

CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';

Now modify template1 so it’s actually a template:

UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';
-=

Now switch to template1 and VACUUM FREEZE the template:

\c template1

VACUUM FREEZE;

exit

One response

Leave a Reply