From f03a91f0787d1ed053e64ea885fbacaed9804a73 Mon Sep 17 00:00:00 2001 From: Bharath Rupireddy Date: Wed, 24 Jun 2020 15:14:43 +0530 Subject: [PATCH v1] COPY command's data format option allows only lowercase csv/text/binary 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. Use pg_strcasecmp() instead of strcmp(). --- src/backend/commands/copy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 6b1fd6d4cc..2416e76cfc 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -1133,11 +1133,11 @@ ProcessCopyOptions(ParseState *pstate, errmsg("conflicting or redundant options"), parser_errposition(pstate, defel->location))); format_specified = true; - if (strcmp(fmt, "text") == 0) + if (pg_strcasecmp(fmt, "text") == 0) /* default format */ ; - else if (strcmp(fmt, "csv") == 0) + else if (pg_strcasecmp(fmt, "csv") == 0) cstate->csv_mode = true; - else if (strcmp(fmt, "binary") == 0) + else if (pg_strcasecmp(fmt, "binary") == 0) cstate->binary = true; else ereport(ERROR, -- 2.25.1