I just did my first install of PostgreSQL 9.1 on Ubuntu 10.04.
note: I have done it a few times on Windows with an installer without issues.
After a bit of effort, I got it set up to connect remotely via pgAdminIII. However, I was really surprised after connecting to the db, that I got a warning about the encoding. The “postgres” database itself was created with “SQL_ASCII” encoding. Every time that I’ve installed on windows, it created the postgres DB with “UTF8” – which seems like it would be a lot better and would stop the warning message when opening up the database via pgAdminIII.
Is there something I did wrong? Is there an installation option/param to use to set the default encoding to use?
And is there anyway to fix this? I’ve read some things on the web that says that you need to dumb and restore to change the encoding of a database, but I’m not sure this is even possible on the postgres db. Is it?
Thanks for your help!
The answer provided by Erwin Brandstetter, was helpful, but for whatever reason, it didn’t work for me. The reason is that I couldn’t initdb to ever run. I kept getting a “bash: command not found” error when trying to run it with the locale. What I ended up doing was:
changing the locale of the OS. For me, this was:
Note: then I had to reboot the server. To confirm that it worked, just run:
with that set, I stopped and dropped the cluster:
note: main is the default cluster that got created for me (your cluster name might be different)
Again, I just recreated the cluster with the same name (main).
Note: because I picked the same cluster name (main), I had to go back and update my .conf files. For me, this specifically was postgres.conf and pg_hba.conf to re-enable remote access to the box. I’m not going to include how to do that here as there is lots of documentation on the web for this. But, if someone wants to edit this answer later to include it, that would be fine! 🙂