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

From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: <david(at)fetter(dot)org>
Cc: <pgman(at)candle(dot)pha(dot)pa(dot)us>, <neilc(at)samurai(dot)com>, <pgsql-bugs(at)postgresql(dot)org>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...
Date: 2006-02-01 03:50:26
Message-ID: 1889.24.211.165.134.1138765826.squirrel@www.dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

David Fetter said:
> On Tue, Jan 31, 2006 at 08:03:41PM -0500, Bruce Momjian wrote:
>> Uh, couldn't the delimiter be a backslash in CVS mode?
>
> I don't think so. Folks?

Using backslash as a delimiter in CSV would be odd, to say the least. As an
escape char it is occasionally used, but not as a delimiter in my
experience. Maybe we should apply the "be liberal in what you accept" rule,
but I think this would be stretching it.

>
> Anyhow, if there are different sets, I could do something like:
>
> #define BADCHARS "\r\n\\"
> #define BADCHARS_CSV "\r\n"
>
> and then check for csv_mode, etc.
>
>> + #define BADCHARS "\r\n\\"
>>
>> 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 ?

cheers

andrew

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2006-02-01 04:33:26 Re: [BUGS] BUG #2221: Bad delimiters allowed in COPY ...
Previous Message David Fetter 2006-02-01 03:44:47 Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-02-01 04:33:26 Re: [BUGS] BUG #2221: Bad delimiters allowed in COPY ...
Previous Message David Fetter 2006-02-01 03:44:47 Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...