Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ... - Mailing list pgsql-bugs

From David Fetter
Subject Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...
Date
Msg-id 20060201024810.GB7231@fetter.org
Whole thread Raw
In response to Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...  ("Andrew Dunstan" <andrew@dunslane.net>)
List pgsql-bugs
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?

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.

Cheers,
D
--
David Fetter david@fetter.org http://fetter.org/
phone: +1 415 235 3778

Remember to vote!

pgsql-bugs by date:

Previous
From: Kris Jurka
Date:
Subject: database level client_encoding setting check
Next
From: David Fetter
Date:
Subject: Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...