diff options
author | Masahiko Sawada <msawada@postgresql.org> | 2024-04-17 11:31:27 +0900 |
---|---|---|
committer | Masahiko Sawada <msawada@postgresql.org> | 2024-04-17 11:31:27 +0900 |
commit | a6d0fa5ef840bc98e14cb34ecf672e6e2e245517 (patch) | |
tree | 56148a2a696b4205160f7e01177aea7ab68e8d91 | |
parent | 58cf2e120e8aee2daed5a9b9ee4471574f712b3b (diff) | |
download | postgresql-a6d0fa5ef840bc98e14cb34ecf672e6e2e245517.tar.gz postgresql-a6d0fa5ef840bc98e14cb34ecf672e6e2e245517.zip |
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
-rw-r--r-- | src/backend/commands/copy.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index f75e1d700d9..df7a4a21c94 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -392,7 +392,7 @@ defGetCopyHeaderChoice(DefElem *def, bool is_from) static CopyOnErrorChoice defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from) { - char *sval; + char *sval = defGetString(def); if (!is_from) ereport(ERROR, @@ -401,15 +401,8 @@ defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from) parser_errposition(pstate, def->location))); /* - * If no parameter value given, assume the default value. - */ - if (def->arg == NULL) - return COPY_ON_ERROR_STOP; - - /* * Allow "stop", or "ignore" values. */ - sval = defGetString(def); if (pg_strcasecmp(sval, "stop") == 0) return COPY_ON_ERROR_STOP; if (pg_strcasecmp(sval, "ignore") == 0) |