Re: postgres 8.2 "end-of-copy marker corrupt"

From: "David Monarchi" <david(dot)e(dot)monarchi(at)gmail(dot)com>
To: "James Long" <pgsql-novice(at)museum(dot)rain(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: postgres 8.2 "end-of-copy marker corrupt"
Date: 2007-03-30 21:20:06
Message-ID: eea51fdb0703301420j11c7efadp65a6b0f92c59baba@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)museum(dot)rain(dot)com> wrote:
>
> On Wed, Mar 28, 2007 at 10:15:35AM -0400, Tom Lane wrote:
> > "David Monarchi" <david(dot)e(dot)monarchi(at)gmail(dot)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
>
>
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Michael 2007-03-30 21:38:53 rounding down a number
Previous Message Sandeep Agarwal 2007-03-30 05:32:01 Re: Data Encryption