diff options
Diffstat (limited to 'src/backend')
-rw-r--r-- | src/backend/commands/copy.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 0b093dbb2a3..3485ba8663f 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -805,12 +805,14 @@ ProcessCopyOptions(ParseState *pstate, "COPY FROM"))); /* Check force_notnull */ - if (!opts_out->csv_mode && opts_out->force_notnull != NIL) + if (!opts_out->csv_mode && (opts_out->force_notnull != NIL || + opts_out->force_notnull_all)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */ errmsg("COPY %s requires CSV mode", "FORCE_NOT_NULL"))); - if (opts_out->force_notnull != NIL && !is_from) + if ((opts_out->force_notnull != NIL || opts_out->force_notnull_all) && + !is_from) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR, @@ -819,13 +821,15 @@ ProcessCopyOptions(ParseState *pstate, "COPY TO"))); /* Check force_null */ - if (!opts_out->csv_mode && opts_out->force_null != NIL) + if (!opts_out->csv_mode && (opts_out->force_null != NIL || + opts_out->force_null_all)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */ errmsg("COPY %s requires CSV mode", "FORCE_NULL"))); - if (opts_out->force_null != NIL && !is_from) + if ((opts_out->force_null != NIL || opts_out->force_null_all) && + !is_from) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR, |