Re: error while trying to change the database encoding on a database

From: Geoffrey Myers <lists(at)serioustechnology(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: error while trying to change the database encoding on a database
Date: 2011-01-24 16:06:38
Message-ID: 4D3DA38E.7030609@serioustechnology.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver wrote:
> On Monday 24 January 2011 7:57:52 am Geoffrey Myers wrote:
>> Adrian Klaver wrote:
>>> On Monday 24 January 2011 6:38:55 am Geoffrey Myers wrote:
>>>> We need to change the database encoding on our databases as they were
>>>> created with the wrong encoding. They were created as SQL_ASCII and we
>>>> are changing them to UTF8.
>>>>
>>>> When testing this Friday, I received the following error:
>>>>
>>>> pg_restore: [archiver (db)] Error while PROCESSING TOC:
>>>> pg_restore: [archiver (db)] Error from TOC entry 5225; 0 16990 TABLE
>>>> DATA cust postgres
>>>> pg_restore: [archiver (db)] COPY failed: ERROR: invalid byte sequence
>>>> for encoding "UTF8": 0xb0
>>>> HINT: This error can also happen if the byte sequence does not match
>>>> the encoding expected by the server, which is controlled by
>>>> "client_encoding".
>>>> CONTEXT: COPY cust, line 778
>>> ^^^^^^^ In the COPY command for that table.
>> I picked up ont that, but the dump is binary, thus I can not view the
>> actual code.
>
> Actually you can :) I should have mentioned it before. You can have pg_restore
> restore to a file instead of a database by using the -f switch. When you do
> that it creates plain text output. You could restore the entire dump to the
> file or use the -t switch to get only the table you need.

Thanks for the suggestion. As it stands, we are getting different
errors for different hex characters, thus the solution we need is the
ability to identify the characters that won't convert from SQL_ASCII to
UTF8. Is there a resource that would identify these characters?

>
>>>> Is there any easy way to figure out which record caused this error?
>>>>
>>>> Thanks.
>>>>
>>>> --
>>>> Until later, Geoffrey
>> --
>> Until later, Geoffrey
>>
>> "I predict future happiness for America if they can prevent
>> the government from wasting the labors of the people under
>> the pretense of taking care of them."
>> - Thomas Jefferson
>
>
>

--
Until later, Geoffrey

"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2011-01-24 16:20:16 Re: error while trying to change the database encoding on a database
Previous Message Adrian Klaver 2011-01-24 16:02:33 Re: error while trying to change the database encoding on a database