Re: [PATCH] COPY command's data format option allows only lowercase csv, text or binary

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] COPY command's data format option allows only lowercase csv, text or binary
Дата
Msg-id 2204307.1593008861@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [PATCH] COPY command's data format option allows only lowercase csv,text or binary  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Ответы Re: [PATCH] COPY command's data format option allows only lowercasecsv, text or binary  (Robert Haas <robertmhaas@gmail.com>)
Re: [PATCH] COPY command's data format option allows only lowercasecsv, text or binary  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список pgsql-hackers
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> writes:
> COPY command's FORMAT option allows only all lowercase csv, text or
> binary, this is true because strcmp is being used while parsing these
> values.

This is nonsense, actually:

regression=# create table foo (f1 int);
CREATE TABLE
regression=# copy foo from stdin (format CSV);
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself, or an EOF signal.

As that shows, there's already a round of lowercasing done by the parser.
The only way that strcasecmp in copy.c would be useful is if you wanted to
accept things like
    copy foo from stdin (format "CSV");
I don't find that to be a terribly good idea.  The normal implication
of quoting is that it *prevents* case folding, so why should that
happen anyway?

More generally, though, why would we want to change this policy only
here?  I believe we're reasonably consistent about letting the parser
do any required down-casing and then just checking keyword matches
with strcmp.

            regards, tom lane



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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: min_safe_lsn column in pg_replication_slots view
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: SIGSEGV from START_REPLICATION 0/XXXXXXX in XLogSendPhysical ()at walsender.c:2762