Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Tim McAuley <mcauleyt(at)tcd(dot)ie>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)
Date: 2003-09-26 19:30:17
Message-ID: Pine.LNX.4.33.0309261325510.815-200000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-jdbc

On Fri, 26 Sep 2003, Tom Lane wrote:

> "scott.marlowe" <scott(dot)marlowe(at)ihs(dot)com> writes:
> > I'm running into issues where 7.4's pg_dump/pg_dumpall from a 7.2 database
> > to a 7.4beta3 database is producing some errors like this:
>
> > ERROR: literal newline found in data
> > HINT: Use "\n" to represent newline.
> > CONTEXT: COPY FROM, line 59
>
> > ERROR: literal carriage return found in data
> > HINT: Use "\r" to represent carriage return.
> > CONTEXT: COPY FROM, line 41
>
> Really? 7.2 should dump data \r or \n as the backslash versions ...
> and does in my tests. Can you make a reproducible test case?

The attached file produces this problem. Note it's a blank trailing field
that looks to be causing it. The error for this .sql file is:

ERROR: literal carriage return found in data
HINT: Use "\r" to represent carriage return.
CONTEXT: COPY FROM, line 2

Note that loading this into pico and saving it back out fixes the problem.

If I remove the preceding row that doesn't end in a blank field, I get a
different error, this one:

ERROR: end-of-copy marker does not match previous newline style
CONTEXT: COPY FROM, line 2

> > It would be nice to have such occurances echo the table / row they are
> > getting the error on, or maybe just the first 20 or so characters, so
> > they'd be easier to identify.
>
> That's not a bad idea. I think it would be fairly easy now for the
> CONTEXT line of the error message to include the input data line:
>
> CONTEXT: COPY FROM, line 41: "data here ...."
>
> at least up through the field where the error gets thrown, and with some
> limit on the length of the data that will get echoed. If people like
> that idea I'll see about making it happen.

table name too, like Bruce said. The bothersome bit is that in pg_dump,
it says the line, relative to just this part of the copy command, so you
don't even know which table is giving the error.

Attachment Content-Type Size
people2.sql text/plain 417 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-09-26 19:35:33 Re: Conditional row grained replication with DBMirror
Previous Message Andrew Dunstan 2003-09-26 19:18:37 Re: initdb failure

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2003-09-26 19:36:54 Re: invalid tid errors in latest 7.3.4 stable.
Previous Message Andrew Dunstan 2003-09-26 19:18:37 Re: initdb failure

Browse pgsql-jdbc by date

  From Date Subject
Next Message CRAIG GOLBY 2003-09-26 19:34:54 Re: Tomcat - PostgreSQL - Cannot load JDBC driverclass"null"
Previous Message Andrew Dunstan 2003-09-26 19:18:37 Re: initdb failure