Content-Length: 288535 | pFad | http://github.com/postgrespro/postgres/commit/a6d0fa5ef840bc98e14cb34ecf672e6e2e245517

96 Disallow specifying ON_ERROR option without value. · postgrespro/postgres@a6d0fa5 · GitHub
Skip to content

Commit a6d0fa5

Browse files
Disallow specifying ON_ERROR option without value.
The ON_ERROR option of the COPY command previously allowed omitting its value, which was inconsistent with the syntax synopsis in the documentation and the behavior of other non-boolean COPY options. This change enforces providing a value for the ON_ERROR option, ensuring consistency across other non-boolean options and aligning with the documented syntax. Author: Atsushi Torikoshi Reviewed-by: Masahiko Sawada Discussion: https://postgr.es/m/a9770bf57646d90dedc3d54cf32634b2%40oss.nttdata.com
1 parent 58cf2e1 commit a6d0fa5

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/backend/commands/copy.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -392,24 +392,17 @@ defGetCopyHeaderChoice(DefElem *def, bool is_from)
392392
static CopyOnErrorChoice
393393
defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from)
394394
{
395-
char *sval;
395+
char *sval = defGetString(def);
396396

397397
if (!is_from)
398398
ereport(ERROR,
399399
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
400400
errmsg("COPY ON_ERROR cannot be used with COPY TO"),
401401
parser_errposition(pstate, def->location)));
402402

403-
/*
404-
* If no parameter value given, assume the default value.
405-
*/
406-
if (def->arg == NULL)
407-
return COPY_ON_ERROR_STOP;
408-
409403
/*
410404
* Allow "stop", or "ignore" values.
411405
*/
412-
sval = defGetString(def);
413406
if (pg_strcasecmp(sval, "stop") == 0)
414407
return COPY_ON_ERROR_STOP;
415408
if (pg_strcasecmp(sval, "ignore") == 0)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/a6d0fa5ef840bc98e14cb34ecf672e6e2e245517

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy