pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Bertheau <twanger@bluetwanger.de>
To: Dario V. Fassi <software@sistemat.com.ar>
Cc: pgsql-admin@postgresql.org
Subject: Re: Migrate postgres databases from SQL_ASCII to UNICODE
Date: Sun, 18 Jul 2004 12:30:52 +0200
Message-ID: <1090146652.2741.1.camel@teetnang> (raw)
In-Reply-To: <40F9B776.9050601@sistemat.com.ar>
References: <40F9B776.9050601@sistemat.com.ar>

В Вск, 18.07.2004, в 01:34, Dario V. Fassi пишет:
> Tom Lane wrote:
> > "Dario V. Fassi" <software@sistemat.com.ar> writes:
> >   
> > > A simple question, we need to migrate many (>20) postgres databases from 
> > > SQL_ASCII encoding to UNICODE encoding, over a 7.3.6 server.
> > >     
> > SQL_ASCII is not an encoding (it's more like the absence of knowledge
> > about an encoding).  What is the data actually stored as?
> >   
> > > With  Dump/Restore , we get an error (Invalid Unicode) in any field that 
> > > has a 8 bits character coming from the SQL_ASCII , even setting the 
> > > client_encoding to WIN, ISO-8859-1,  and others encodings.
> > >     
> > It might work to just UPDATE pg_database to set datencoding to the
> > correct value reflecting what you have actually stored.  You might then
> > need to REINDEX any indexes on textual columns, but I don't think
> > anything else would go wrong.
> > 
> > If you have a mishmash of different encodings in a single database, then
> > of course there is no simple solution; you are in for some pain while
> > you try to fix the data.
> >   
> 
> Yes you are right , the original data come from a DB2 with CodePage
> IBM-850  and was inserted  without complains in a Postgres 7.3.6 with
> SQL_ASCII.
> 
> Now we are in a Jail , because IBM-850 , isn't WIN, isn't  ISO-xx ,
> isn't no one postgresql's encoding. 
> So when in change via pg_databases the encoding , 8 bits characters
> become garbage.
> More even if we accept this garbage chars and we set encoding to e.g.
> ISO-8859-1   it's impossible go to a UNICODE because this garbage
> chars are invalid in client's encoding , so they are reject (in
> translation process as invalid unicode chars).

You can dump the data, convert it with for example iconv and then load
the data again.

-- 
Markus Bertheau <twanger@bluetwanger.de>




view thread (11+ messages)  latest in thread

Message-ID: <1090146652.2741.1.camel@teetnang>
Permalink:  ../1090146652.2741.1.camel@teetnang/
Also on:    postgresql.org/message-id/1090146652.2741.1.camel@teetnang

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: twanger@bluetwanger.de, software@sistemat.com.ar
  Subject: Re: Migrate postgres databases from SQL_ASCII to UNICODE
  In-Reply-To: <1090146652.2741.1.camel@teetnang>
  References: <40F9B776.9050601@sistemat.com.ar> <1090146652.2741.1.camel@teetnang>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox