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