Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a39297e

Browse files
committed
Move check for binary mode and on_error option to the appropriate location.
Commit 9e2d870 placed the check for binary mode and on_error before default values were inserted, which was not ideal. This commit moves the check to a more appropriate position after default values are set. Additionally, the comment incorrectly mentioned two checks before inserting defaults, when there are actually three. This commit corrects that comment. Author: Atsushi Torikoshi Reviewed-by: Fujii Masao Discussion: https://postgr.es/m/8830518a-28ac-43a2-8a11-1676d9a3cdf8@oss.nttdata.com
1 parent 4ac2a9b commit a39297e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/backend/commands/copy.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ ProcessCopyOptions(ParseState *pstate,
672672
}
673673

674674
/*
675-
* Check for incompatible options (must do these two before inserting
675+
* Check for incompatible options (must do these three before inserting
676676
* defaults)
677677
*/
678678
if (opts_out->binary && opts_out->delim)
@@ -691,11 +691,6 @@ ProcessCopyOptions(ParseState *pstate,
691691
(errcode(ERRCODE_SYNTAX_ERROR),
692692
errmsg("cannot specify %s in BINARY mode", "DEFAULT")));
693693

694-
if (opts_out->binary && opts_out->on_error != COPY_ON_ERROR_STOP)
695-
ereport(ERROR,
696-
(errcode(ERRCODE_SYNTAX_ERROR),
697-
errmsg("only ON_ERROR STOP is allowed in BINARY mode")));
698-
699694
/* Set defaults for omitted options */
700695
if (!opts_out->delim)
701696
opts_out->delim = opts_out->csv_mode ? "," : "\t";
@@ -900,6 +895,11 @@ ProcessCopyOptions(ParseState *pstate,
900895
errmsg("NULL specification and DEFAULT specification cannot be the same")));
901896
}
902897
/* Check on_error */
898+
if (opts_out->binary && opts_out->on_error != COPY_ON_ERROR_STOP)
899+
ereport(ERROR,
900+
(errcode(ERRCODE_SYNTAX_ERROR),
901+
errmsg("only ON_ERROR STOP is allowed in BINARY mode")));
902+
903903
if (opts_out->reject_limit && !opts_out->on_error)
904904
ereport(ERROR,
905905
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),

0 commit comments

Comments
 (0)