Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 9F8DC9FB30F for ; Sat, 7 Apr 2007 18:29:53 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 29036-07 for ; Sat, 7 Apr 2007 18:29:49 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by postgresql.org (Postfix) with ESMTP id 492E89FB31F for ; Sat, 7 Apr 2007 18:29:41 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so1281620ugf for ; Sat, 07 Apr 2007 14:29:39 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=IXW40BTtW1C3OjEOJO9wrdQHiwaZlfoauWi1zJU0MuRY2W1Yx8EeHDmfE0TWlbLhJaUNz+YfcY245b3oa3pv+0zSPHK7Qp8MDqon6L3rLmkK+/l5TiwIIv+C9v8nD1uTzdCIxelxA9YHK37l84N9dfUbJ5SZK/Co9TL39Tl3hAk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=oaeGIGileARNTYbTdcXOVnT2mhGYQKnOneNU6COSIlIm87XI9iuC3xub6PqcxzPbLmb8bcKj1zI7ZmO4fUdycxpgy7FjnSIAMSJeYdnGaQNuP81w9tweaI2afdtm8H+QXh/MV6+Ke3YyLSCZ1as4Lri9BmpE1+f3QgtGaG7TUCA= Received: by 10.82.188.15 with SMTP id l15mr6030041buf.1175981379605; Sat, 07 Apr 2007 14:29:39 -0700 (PDT) Received: by 10.82.173.15 with HTTP; Sat, 7 Apr 2007 14:29:39 -0700 (PDT) Message-ID: <1c66bda80704071429p68409036oa2f384a61d8d5811@mail.gmail.com> Date: Sun, 8 Apr 2007 09:29:39 +1200 From: adey To: "Dan Harris" Subject: Re: Can't restore a pg_dump due to encoding errors Cc: pgsql-admin@postgresql.org In-Reply-To: <46180885.4050504@drivefaster.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_15235_12324811.1175981379561" References: <46180885.4050504@drivefaster.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/68 X-Sequence-Number: 25132 ------=_Part_15235_12324811.1175981379561 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline We had a similar conversion conflict some time back whe upgrading and found using a search for anything not A-Z, 0-9, etc, was useful to find offensive data and fix it. On 4/8/07, Dan Harris wrote: > > Hello all: > > I'm in a bit of a bind here. Today is my maintenance window for upgrading > from > 8.0.3 to 8.2.3. I did a pg_dumpall overnight ( resulting in a 72GB file ) > and > then a pg_dump on one of my small databases this morning to test > pg_restore. > When trying to reload, I'm getting the following error: > > psql:sac.bak:2793776: ERROR: invalid byte sequence for encoding "UTF8": > 0x92 > > A google search came up with this link: > http://www.hostingforum.ca/280472-invalid-byte-sequence-encoding-utf8.html > > Which sounds very simliar to what's going on here. > > Again the dump was done on 8.0.3, which sounds like it was before the > anti-sql > injection patch that would refuse to import "invalid" characters. The > database > ( for now ) *should* only be storing English/Latin characters. Although, > the > old server had LOCALE='C' previously ( this was unnecessary so I'm trying > to > drop that today ). I don't know if this would matter, but that's the only > thing > that was different from a bog standard Postgres setup besides the obvious > tuning > changes. I have never changed any of the encoding settings on client or > server > from the defaults. > > So far, I tried editing the dump file and changing the client_encoding to > 'UTF8' > at the top, hoping this might make a difference but did not. > > The advice in that thread seems to be "fix the bad data". But I am not > seeing > how I can tell exactly what or where this bad data is. Luckily, this > small dump > file is manageable by opening in vim and pointing to the line 2793776 the > error > references, however the line referenced is just the "\." at the end of a > huge > COPY section. I don't know which line inside that secion is the problem > and > there's enough of them that it'd be pretty impractical for me to visually > scan > the file looking for something ( I'm not even quite sure what to look for > at > this point ). And, if that is the only solution and I run into a problem > restoring the 72GB dump file, I'm going to be in some serious trouble, > especially if I am not alerted to the problem until *after* it's finished > looking at all the COPY statements! > > What say the sages? > > Thanks > > -Dan > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly > ------=_Part_15235_12324811.1175981379561 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline We had a similar conversion conflict some time back whe upgrading and found using a search for anything not A-Z, 0-9, etc, was useful to find offensive data and fix it.

On 4/8/07, Dan Harris <fbsd@drivefaster.net> wrote:
Hello all:

I'm in a bit of a bind here.  Today is my maintenance window for upgrading from
8.0.3 to 8.2.3.  I did a pg_dumpall overnight ( resulting in a 72GB file ) and
then a pg_dump on one of my small databases this morning to test pg_restore.
When trying to reload, I'm getting the following error:

psql:sac.bak:2793776: ERROR:  invalid byte sequence for encoding "UTF8": 0x92

A google search came up with this link:
http://www.hostingforum.ca/280472-invalid-byte-sequence-encoding-utf8.html

Which sounds very simliar to what's going on here.

Again the dump was done on 8.0.3, which sounds like it was before the anti-sql
injection patch that would refuse to import "invalid" characters.  The database
( for now ) *should* only be storing English/Latin characters.  Although, the
old server had LOCALE='C' previously ( this was unnecessary so I'm trying to
drop that today ).  I don't know if this would matter, but that's the only thing
that was different from a bog standard Postgres setup besides the obvious tuning
changes.  I have never changed any of the encoding settings on client or server
from the defaults.

So far, I tried editing the dump file and changing the client_encoding to 'UTF8'
at the top, hoping this might make a difference but did not.

The advice in that thread seems to be "fix the bad data".  But I am not seeing
how I can tell exactly what or where this bad data is.  Luckily, this small dump
file is manageable by opening in vim and pointing to the line 2793776 the error
references, however the line referenced is just the "\." at the end of a huge
COPY section.  I don't know which line inside that secion is the problem and
there's enough of them that it'd be pretty impractical for me to visually scan
the file looking for something ( I'm not even quite sure what to look for at
this point ).  And, if that is the only solution and I run into a problem
restoring the 72GB dump file, I'm going to be in some serious trouble,
especially if I am not alerted to the problem until *after* it's finished
looking at all the COPY statements!

What say the sages?

Thanks

-Dan

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly

------=_Part_15235_12324811.1175981379561--