During setup: "ERROR: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)"

Full error log: PG::InvalidParameterValue: ERROR: new encoding (UTF8) is incompatible with the - Pastebin.com
I’m following this guide: this guide but during the setup phase it throws out this error. Do I have to create the database manually, or did I do something wrong during the setup process?

System: Armbian 10 on unstable repos

I don’t know why your distribution has decided to initialize PostgreSQL cluster with an ASCII encoding. You might want to reinstall PostgreSQL completely but with a different encoding.

Debian derivatives have a command

 pg_createcluster -e <encoding> <version> <clustername>

which allows you to create a new cluster with a desired encoding. The default cluster is called main.

You can list all clusters with pg_lsclusters but to check the encoding you need to start

 psql template1

and inside ask for

\l+ template1

It should give something like this

                                                           List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   |  Size   | Tablespace |        Description        
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | postgres=CTc/postgres+| 7112 kB | pg_default | default template database
           |          |          |             |             | =c/postgres           |         |            | 
(1 row)

If you have ASCII in the Encoding column I’d re-create the cluster with UTF8

Indeed, the database had the SQL_ASCII encoding. I used the commands in this gist and it seemed to fix it.

Also broke my postgres install while attempting to remove the main database (fixed it using the second answer in this Stack Overflow thread). :stuck_out_tongue:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.