Re: Changing encoding of a database - Mailing list pgsql-general

From TJ O'Donnell
Subject Re: Changing encoding of a database
Date
Msg-id 2581.68.166.1.188.1151086455.squirrel@www.gnova.com
Whole thread Raw
In response to Changing encoding of a database  ("Marco Bizzarri" <marco.bizzarri@gmail.com>)
List pgsql-general
> We've PostgreSQL database, with SQL_ASCII or LATIN1 encoding. We would
> like to migrate them to UNICODE. Is there some contributed/available
> script, or this is something we should do at hand?
I had a similar problem migrating from 7.4 to 8.1 and wanting to
go from sql_ascii to utf8.  I did the following:

pg_dump -p 5433 --encoding ISO_8859_7 -t cas tj |psql tj

where the dump connected to 7.4 (port 5433) and interpreted the
cas data using ISO_8859_7.  psql connected to 8.1
I had to experiment to find that ISO_8859_7 was the "proper"
encoding - i had some greek (math and chemistry) letters which
were accomodated by sql_ascii, but not quite "properly".
The output from pg_dump above properly converts to utf8
which 8.1 (i set the default enccoding utf8) accepts without complaint.

See http://www.postgresql.org/docs/8.1/static/multibyte.html
for all the other encodings.

I don't think the above will convert a table in place, but could be
used to create a copy with changed encoding.
Hope this helps.

TJ



pgsql-general by date:

Previous
From: Joseph Shraibman
Date:
Subject: Re: Idea for vacuuming
Next
From: Tom Lane
Date:
Subject: Re: pg_dump With OIDs Supported?