Re: postgres 8.2 "end-of-copy marker corrupt" - Mailing list pgsql-novice

From David Monarchi
Subject Re: postgres 8.2 "end-of-copy marker corrupt"
Date
Msg-id eea51fdb0703301420j11c7efadp65a6b0f92c59baba@mail.gmail.com
Whole thread Raw
In response to Re: postgres 8.2 "end-of-copy marker corrupt"  (James Long <pgsql-novice@museum.rain.com>)
List pgsql-novice
Hi Tom -

Thanks for the suggestions.  You were correct, and it was a combination of problems.  The field delimiter was a tab, and there were text fields that ended with a \, so of course that caused problems.  There were also single quotes in the text fields, but they didn't occur in pairs.  Rather they were possessive case nouns.  And finally there were double quotes.  And, oddly enough, they didn't always occur in pairs.  In fact, sometimes the double quote was the only character in the text field.  The double quotes didn't turn out to be a problem.

I did the following.
1) replaced all \tab combinations with blankTab.
2) replaced all 's with two single quotes, '', because \' doesn't work in a copy statement.

Following this, everything loaded just fine.

Thank you again for you help, and for pointing me in the right direction.

cheers,
david

On 3/28/07, James Long < pgsql-novice@museum.rain.com> wrote:
On Wed, Mar 28, 2007 at 10:15:35AM -0400, Tom Lane wrote:
> "David Monarchi" <david.e.monarchi@gmail.com> writes:
> > Each line is terminated with a LF (0A), including the last line.  This is
> > the structure that of all of the other files that I can load have.
> > Some of the text fields in the file had \ in them, so I simply replaced all
> > of them with blanks to see if somewhere there was an escape sequence that
> > was causing the problem.
>
> Hm ... AFAICS from looking at the code, it's impossible to get that
> error message unless the file contains \ followed by . followed by
> something that's not either CR or LF.

What is the output of:

grep -c "\\\."

and if that is a "small" number, the output of:

grep -n "\\\."

and

grep "\\\." | hexdump -C



pgsql-novice by date:

Previous
From: "Sandeep Agarwal"
Date:
Subject: Re: Data Encryption
Next
From: "Michael"
Date:
Subject: rounding down a number