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

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

Bruce Momjian wrote:
> scott.marlowe wrote:
> > 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
>
> OK, 'vi' shows it as:
>
> COPY people2 (id, persons) FROM stdin;
> 59 Chance Terry--S
> 60 ^M
> \.

The significant issue here is that we don't want to throw a warning in
this case; it should be an error --- this is clearly a data value we
don't want to discard as part of the end-of-line.

The argument that you want a warning because you might have mixed
newlines in the file seems less likely than this case where they are
using a literal carriage return as a data value at the end of the line.

Seems we should just fix initdb as my patch does and see if we get any
more mixed-newline cases or literal carriage-return data cases. My
guess is that we will get more of the latter.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeremiah Elliott 2003-09-26 19:48:55 Re: Schema backup
Previous Message scott.marlowe 2003-09-26 19:43:53 Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Sullivan 2003-09-26 19:44:35 Re: 2-phase commit
Previous Message scott.marlowe 2003-09-26 19:43:53 Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)

Browse pgsql-jdbc by date

  From Date Subject
Next Message Bruce Momjian 2003-09-26 19:57:17 Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)
Previous Message scott.marlowe 2003-09-26 19:43:53 Re: initdb failure (was Re: [GENERAL] sequence's plpgsql)