Ever wondered how you could change the encoding of one of your Postgres database?
I have had that problem several times, and in most cases people tell you to:
The problem is that there is no support for altering the encoding of a database. The ALTER DATABASE does not include that option. And since it should be really rare, it makes sense.
Now, there is an easier way than using the pg_dump
command. There are the steps:
To be more secure, you may want to dump the database first (just in case). But see how this is done: you rename the database as a template database, then you create a new database using the old database as a template and the correct encoding (UTF-8 here.)