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

Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...

From: David Fetter <david(at)fetter(dot)org>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Neil Conway <neilc(at)samurai(dot)com>, pgsql-bugs(at)postgresql(dot)org,PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...
Date: 2006-01-30 18:15:57
Message-ID: 20060130181557.GI6212@fetter.org (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
On Mon, Jan 30, 2006 at 08:21:34AM -0500, Andrew Dunstan wrote:
> 
> 
> David Fetter wrote:
> 
> > 
> >+ 	/* Disallow BADCHARS characters */
> >+ 	if (strcspn(cstate->delim, BADCHARS) != 1)
> >+ 		ereport(ERROR,
> >+ 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> >+ 				 errmsg("COPY delimiter cannot be \"%#02x\"",
> >+ 						*cstate->delim)));
> >+ 
> 
> Is  ERRCODE_FEATURE_NOT_SUPPORTED the right errcode? This isn't a
> missing feature; we are performing a sanity check here. We can
> reasonably expect never to support CR, LF or \ as the text
> delimiter.

I guess that depends on whether we ever plan to allow people to set
the output record separator to something other than CR?LF.

> Maybe ERRCODE_INVALID_PARAMETER_VALUE ? Or maybe we need a new one.
> 
> Also, I would probably make the format %#.02x so the result would
> look like 0x0d (for a CR).
> 
> (I bet David never thought there would so much fuss over a handful
> of  lines of code)

Actually, I'm happy to see it's getting QA.  COPY is something that
has Consequences™ if anything goes wrong with it, so I'd rather do
best efforts up front to get it right. :)

Cheers,
D
-- 
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 415 235 3778

Remember to vote!

In response to

Responses

pgsql-bugs by date

Next:From: Neil ConwayDate: 2006-01-30 22:40:44
Subject: Re: Bug#347548: DOMAIN CHECK constraint bypassed
Previous:From: Clifford WolfDate: 2006-01-30 17:23:47
Subject: Re: [Sd-log] Re: Endless loop in ExecNestLoop

pgsql-patches by date

Next:From: Jim C. NasbyDate: 2006-01-30 18:42:24
Subject: Re: Want to add to contrib.... xmldbx
Previous:From: Frank WilesDate: 2006-01-30 17:19:56
Subject: Re: Want to add to contrib.... xmldbx

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