Re: Changing encoding of a database

From: "TJ O'Donnell" <tjo(at)acm(dot)org>
To: <marco(dot)bizzarri(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Changing encoding of a database
Date: 2006-06-23 18:14:15
Message-ID: 2581.68.166.1.188.1151086455.squirrel@www.gnova.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2006-06-23 18:17:43 Re: pg_dump With OIDs Supported?
Previous Message Joseph Shraibman 2006-06-23 18:00:38 Re: Idea for vacuuming