pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Simone Tellini <tellini@areabusiness.it>
Cc: pgsql-admin@postgresql.org
Subject: Re: restore whoes
Date: Mon, 11 Feb 2002 15:34:08 -0500 (EST)
Message-ID: <200202112034.g1BKY8K13538@candle.pha.pa.us> (raw)
In-Reply-To: <15318.1013459436@sss.pgh.pa.us>

Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> In the examples given, the error didn't show up till later rows, in
> >> fields where there was no \r anywhere.
> 
> > Hard to imagine why a failure would occur on anything but the first row.
> 
> Simple: suppose the dumped data contains \ \n in the body of a field,
> which is the currently-accepted representation for a data newline.
> Microsoft munges this to \ \r \n, which will now be read by COPY IN as a
> backslashed \r (ie, a data \r) followed by a non-escaped newline.
> Ergo, that's the end of the current row.  No error is detected (since a
> datatype that could have contained a data \n is unlikely to reject a
> data \r).  Then parsing resumes for the next row at the next input
> character.  We're totally out of sync and will produce lord only knows
> what peculiar error message when, eventually, some datatype input
> converter doesn't like what it's given.  But that could be many rows
> later than where the problem was.
> 
> Part of the problem here is that COPY IN will accept a "short" row (one
> with fewer fields than the table actually has columns).  So early
> termination of a line isn't recognizable as an error unless the last
> column that receives some data manages to recognize a formatting error.
> Personally I think it would be a good idea to change that --- but I
> suppose you'll complain that that might break existing applications,
> even though the "feature" has never been documented.

No, I will not complain at all.  We should not accept short rows,
period.  It is reasonable to expect a full row every time. I just think
forcing the escape of \r isn't reasonable.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (30+ messages)  latest in thread

Message-ID: <200202112034.g1BKY8K13538@candle.pha.pa.us>
Permalink:  ../200202112034.g1BKY8K13538@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200202112034.g1BKY8K13538@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: pgman@candle.pha.pa.us, tgl@sss.pgh.pa.us, tellini@areabusiness.it
  Subject: Re: restore whoes
  In-Reply-To: <200202112034.g1BKY8K13538@candle.pha.pa.us>
  References: <15318.1013459436@sss.pgh.pa.us> <200202112034.g1BKY8K13538@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox