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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: David Fetter <david(at)fetter(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, neilc(at)samurai(dot)com, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #2221: Bad delimiters allowed in COPY ...
Date: 2006-02-01 04:33:26
Message-ID: 200602010433.k114XQE18443@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

> On Tue, Jan 31, 2006 at 09:50:26PM -0600, Andrew Dunstan wrote:
> > >> Also, should we disable DELIMITER and NULL from sharing characters?
> > >
> > > That's on about line 916, post-patch:
> > >
> > > /* Don't allow the delimiter to appear in the null string. */
> > > if (strchr(cstate->null_print, cstate->delim[0]) != NULL)
> > > ereport(ERROR,
> > > (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> > > errmsg("COPY delimiter must not appear in the NULL
> > > specification")));
> > >
> > > I suppose that a different error code might be The Right Thing
> > > here.
> >
> > ERRCODE_WHAT WERE_YOU_THINKING ?
>
> That's an excellent candidate, or maybe ERRCODE_INVALID_PARAMETER_VALUE.
> My vote is for ERRCODE_D00D_WTF ;)
>
> Maybe we need an error code for mutually incompatible param values.

Attached is a patch that errors for \r and \n in delimiter and null. I
kept the ERRCODE_FEATURE_NOT_SUPPORTED error code because that is what
all the other error tests use in the copy code in that area. I did
nothing with backslash.

FYI, David, my email reader is having problems reading your emails
because of this line:

Content-Type: text/plain; charset=iso_8859_1

My understanding is this should be iso-8859-1, with dashes.

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

Attachment Content-Type Size
unknown_filename text/plain 1.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-02-01 06:16:08 Re: [BUGS] BUG #2221: Bad delimiters allowed in COPY ...
Previous Message Andrew Dunstan 2006-02-01 03:50:26 Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2006-02-01 06:16:08 Re: [BUGS] BUG #2221: Bad delimiters allowed in COPY ...
Previous Message Andrew Dunstan 2006-02-01 03:50:26 Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...