Login to Members Area

Choose the service you want to log in
     
24x7x365 Presence
1-888-289-2246
Live Chat

Hosting Blog

 

How to change PostgreSQL database encoding

To accomplish this task, we need to delete the existing database first and then re-create the same with the required encoding.

Steps:-
  1. Login to the respective PostgreSQL server
  2. su -l postgres
  3. dropdb <databasename>
  4. createdb -E UNICODE -O <databaseowner> <databasename>
  5. Exit

Note :- If the database contains data, it will be lost. So, it is advisable to take the backup of the database before deletion. After the creation of the database with the required encoding, data can be restored from the backup.

Abhishek Monday 01 July 2013 - 9:01 pm | | Default

two comments

Acoma

This is stupid, as it sets encoding, not collation. Those are two different things.

Acoma, - 27-01-’14 05:55
Blog-admin

Sorry about the confusion, Acoma. The title and URL now reflect the purpose of the post – it is about encoding, not collation.

Blog-admin, - 03-03-’14 14:30
(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.