Skip site navigation (1) Skip section navigation (2)

Re: problem with pg_restore

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Chris McCormick <cmccormick(at)mailsnare(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: problem with pg_restore
Date: 2004-06-04 15:00:43
Message-ID: 27491.1086361243@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
Chris McCormick <cmccormick(at)mailsnare(dot)net> writes:
>    It ran for a while (creating all the table defs) and the I got the 
> following messages:
>    pg_restore: ERROR:   literal carriage return found in data.

>    So, I had some bad carriage returns.  I found an answer at 
> (http://forums.devshed.com/archive/t-99865), which suggested using sed 
> to fix the carriage returns.  I did that, creating backup2.tar.

You can't do that to a tar (or custom) format dump file, because you'll
clobber the tar metadata, which is full of raw-binary numbers, not to
mention absolute file lengths that will be wrong after sed hacks the data.

The basic problem here is that COPY's handling of embedded CRs changed
somewhere around 7.2, and the backwards compatibility kluge that was in
place for awhile isn't there anymore in 7.4.

Probably the least painful solution is to repeat the dump, adding the -d
switch (or whichever one it is that selects dump-as-INSERTs instead of
dump-as-COPY).  This will take much longer to restore :-( but a manual
solution that allows COPY will probably take even longer in total.

If you can't repeat the dump because you don't have the original 7.1
installation anymore, you might be forced into a serial upgrade: install
7.2, reload, dump, install 7.4, reload.  I think you can skip 7.3,
or skip 7.2 and use 7.3 as the intermediate step --- IIRC both 7.2 and
7.3 contain the backwards-compatibility kluge for the old COPY data
format.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Lynna LandstreetDate: 2004-06-04 23:03:13
Subject: Modifying an existing constraint?
Previous:From: Chris McCormickDate: 2004-06-04 13:33:50
Subject: problem with pg_restore

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group