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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: David Fetter <david(at)fetter(dot)org>
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 13:21:34
Message-ID: 43DE12DE.6010107@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches

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

cheers

andrew

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Patrick Rotsaert 2006-01-30 14:50:06 BUG #2225: Backend crash -- BIG table
Previous Message Herv Hnoch 2006-01-30 10:47:10 BUG #2224: unlogical syntax error

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2006-01-30 13:25:33 Re: Want to add to contrib.... xmldbx
Previous Message dueyduey 2006-01-30 10:33:35 BUG #2223: Misleading info in docs on volatility level of functions