PostgreSQL come creare un Database con un encoding diverso da quello di sistema

Se state creando un database ma il vostro Postgresql vi tedia con un errore del tipo:

new encoding (UTF8) is incompatible with the encoding of the template database (LATIN1)

Non vi scoraggiate, semplicemente dovete usare il template0, ad esempio, invece di:

CREATE DATABASE scuola247
    WITH OWNER = postgres
    ENCODING = 'UTF8'
    TABLESPACE = pg_default
    LC_COLLATE = 'it_IT.UTF-8'
    LC_CTYPE = 'it_IT.UTF-8'
   CONNECTION LIMIT = -1;

dovete usare:

CREATE DATABASE scuola247
    WITH OWNER = postgres
    TEMPLATE = template0
    ENCODING = 'UTF8'
    TABLESPACE = pg_default
    LC_COLLATE = 'it_IT.UTF-8'
    LC_CTYPE = 'it_IT.UTF-8'
   CONNECTION LIMIT = -1;

Ciao

Andrea

Lascia un commento