UnixServerAdmin

Server Administration & Management

How to change database encoding value for postgresql database

We can change database encoding values for postgresql database by using following steps but make sure that you have taken backup for current database.

1. Log in to server as root user and switch to postgres

# su postgres

2. To check all database run

# psql -l

3. To switch database for example we are using support_test

# psql -d support_test

4. Run command to check encoding

support_test=# encoding
UTF8

SET CLIENT_ENCODING TO ‘LATIN1′;
or
SET NAMES ‘LATIN1′;

5. Now check encoding

support_test=# SHOW client_encoding;
client_encoding

November 14, 2011 - Posted by | PgSQL | ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: