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

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...
Дата
Msg-id 43DE12DE.6010107@dunslane.net
обсуждение исходный текст
Ответ на Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...  (David Fetter <david@fetter.org>)
Ответы Re: [PATCHES] BUG #2221: Bad delimiters allowed in COPY ...  (David Fetter <david@fetter.org>)
Список pgsql-bugs

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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Hervé Hénoch"
Дата:
Сообщение: BUG #2224: unlogical syntax error
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2224: unlogical syntax error