Skip site navigation (1) Skip section navigation (2)

Re: [BUGS] BUG #2114: (patch) COPY FROM ... end of copy marker

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Ben Gould <ben(dot)gould(at)free(dot)fr>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #2114: (patch) COPY FROM ... end of copy marker
Date: 2005-12-27 18:20:58
Message-ID: 200512271820.jBRIKwU22101@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
Bruce Momjian wrote:
> Andrew Dunstan wrote:
> > 
> > 
> > Bruce Momjian wrote:
> > 
> > > The big problem is that \. is also a valid
> > >CSV data value (though not a valid non-CSV data value).  So, the
> > >solution we came up with was to require \. to appear alone on a line in
> > >CSV mode for it to be treated as end-of-copy.  
> > >
> > 
> > According to the docs, that's the way to specify EOD in both text and 
> > CSV mode:
> > 
> >   End of data can be represented by a single line containing just 
> > backslash-period.
> 
> Right, but in non-CSV mode, we allow \. at the end of any line because
> it is unique so I kept that behavior.  That is not documented however.
> 
> > Your analysis regarding line_buf.len seems correct.
> > 
> > We probably should have a regression test with \. in a CSV field.
> 
> Agreed.  My test for CSV was simple, just try loading:
> 
> 	x\.
> 	x\.b
> 	\.c
> 
> all should load literally, but they fail.

OK, original patch applied to HEAD and smaller version to 8.1.X, and
regression test added, now attached.

-- 
  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

pgsql-bugs by date

Next:From: Luke LonerganDate: 2005-12-28 03:25:53
Subject: Re: [BUGS] BUG #2114: (patch) COPY FROM ... end of
Previous:From: Bruce MomjianDate: 2005-12-27 17:49:13
Subject: Re: [BUGS] BUG #2114: (patch) COPY FROM ... end of copy marker

pgsql-patches by date

Next:From: Greg StarkDate: 2005-12-27 18:59:41
Subject: Re: [HACKERS] Online backup vs Continuous backup
Previous:From: Bruce MomjianDate: 2005-12-27 17:49:13
Subject: Re: [BUGS] BUG #2114: (patch) COPY FROM ... end of copy marker

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group