Re: Move data between two databases SQL-ASCII to UTF8

From: Clodoaldo <clodoaldo(dot)pinto(dot)neto(at)gmail(dot)com>
To: "MargaretGillon(at)chromalloy(dot)com" <MargaretGillon(at)chromalloy(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Move data between two databases SQL-ASCII to UTF8
Date: 2007-02-09 00:42:47
Message-ID: a595de7a0702081642o44e9c349p40662a9ddfbe6598@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2007/2/8, MargaretGillon(at)chromalloy(dot)com <MargaretGillon(at)chromalloy(dot)com>:
>
> I need to convert my database to UTF8. Is there a way to do a SELECT ...
> INSERT from the old database table to the new one? Would the INSERT correct
> data errors between the two data types? I only have 10 tables and the
> biggest has < 8000 rows.

Use pg_dump to dump the db and use iconv on the generated file:

iconv -f ASCII -t UTF-8 mydb.dump -o mydb_utf8.dump

<GUESS>
If the characters are strictly ASCII (<=127) then the conversion will
not be necessary. But if there are characters bigger than 127 then the
conversion will have to be made from iso-8859-1 to utf-8:

iconv -f ISO_8859-1 -t UTF-8 mydb.dump -o mydb_utf8.dump
</GUESS>

Regards,
--
Clodoaldo Pinto Neto

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dean Grubb 2007-02-09 00:49:59 Headache with a plpgsql function
Previous Message MargaretGillon 2007-02-09 00:07:29 Move data between two databases SQL-ASCII to UTF8