aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/copy.c')
-rw-r--r--src/backend/commands/copy.c76
1 files changed, 55 insertions, 21 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index df7a4a21c94..3bb579a3a44 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -397,7 +397,9 @@ defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from)
if (!is_from)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("COPY ON_ERROR cannot be used with COPY TO"),
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
+ second %s is a COPY with direction, e.g. COPY TO */
+ errmsg("COPY %s cannot be used with %s", "ON_ERROR", "COPY TO"),
parser_errposition(pstate, def->location)));
/*
@@ -410,7 +412,8 @@ defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("COPY ON_ERROR \"%s\" not recognized", sval),
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR */
+ errmsg("COPY %s \"%s\" not recognized", "ON_ERROR", sval),
parser_errposition(pstate, def->location)));
return COPY_ON_ERROR_STOP; /* keep compiler quiet */
}
@@ -434,7 +437,8 @@ defGetCopyLogVerbosityChoice(DefElem *def, ParseState *pstate)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("COPY LOG_VERBOSITY \"%s\" not recognized", sval),
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR */
+ errmsg("COPY %s \"%s\" not recognized", "LOG_VERBOSITY", sval),
parser_errposition(pstate, def->location)));
return COPY_LOG_VERBOSITY_DEFAULT; /* keep compiler quiet */
}
@@ -647,17 +651,18 @@ ProcessCopyOptions(ParseState *pstate,
if (opts_out->binary && opts_out->delim)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("cannot specify DELIMITER in BINARY mode")));
+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
+ errmsg("cannot specify %s in BINARY mode", "DELIMITER")));
if (opts_out->binary && opts_out->null_print)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("cannot specify NULL in BINARY mode")));
+ errmsg("cannot specify %s in BINARY mode", "NULL")));
if (opts_out->binary && opts_out->default_print)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("cannot specify DEFAULT in BINARY mode")));
+ errmsg("cannot specify %s in BINARY mode", "DEFAULT")));
if (opts_out->binary && opts_out->on_error != COPY_ON_ERROR_STOP)
ereport(ERROR,
@@ -731,13 +736,15 @@ ProcessCopyOptions(ParseState *pstate,
if (opts_out->binary && opts_out->header_line)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("cannot specify HEADER in BINARY mode")));
+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
+ errmsg("cannot specify %s in BINARY mode", "HEADER")));
/* Check quote */
if (!opts_out->csv_mode && opts_out->quote != NULL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY QUOTE requires CSV mode")));
+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
+ errmsg("COPY %s requires CSV mode", "QUOTE")));
if (opts_out->csv_mode && strlen(opts_out->quote) != 1)
ereport(ERROR,
@@ -753,7 +760,8 @@ ProcessCopyOptions(ParseState *pstate,
if (!opts_out->csv_mode && opts_out->escape != NULL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY ESCAPE requires CSV mode")));
+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
+ errmsg("COPY %s requires CSV mode", "ESCAPE")));
if (opts_out->csv_mode && strlen(opts_out->escape) != 1)
ereport(ERROR,
@@ -764,71 +772,97 @@ ProcessCopyOptions(ParseState *pstate,
if (!opts_out->csv_mode && (opts_out->force_quote || opts_out->force_quote_all))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY FORCE_QUOTE requires CSV mode")));
+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
+ errmsg("COPY %s requires CSV mode", "FORCE_QUOTE")));
if ((opts_out->force_quote || opts_out->force_quote_all) && is_from)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY FORCE_QUOTE cannot be used with COPY FROM")));
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
+ second %s is a COPY with direction, e.g. COPY TO */
+ errmsg("COPY %s cannot be used with %s", "FORCE_QUOTE",
+ "COPY FROM")));
/* Check force_notnull */
if (!opts_out->csv_mode && opts_out->force_notnull != NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY FORCE_NOT_NULL requires CSV mode")));
+ /*- 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)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("COPY FORCE_NOT_NULL cannot be used with COPY TO")));
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
+ second %s is a COPY with direction, e.g. COPY TO */
+ errmsg("COPY %s cannot be used with %s", "FORCE_NOT_NULL",
+ "COPY TO")));
/* Check force_null */
if (!opts_out->csv_mode && opts_out->force_null != NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY FORCE_NULL requires CSV mode")));
+ /*- 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)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("COPY FORCE_NULL cannot be used with COPY TO")));
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
+ second %s is a COPY with direction, e.g. COPY TO */
+ errmsg("COPY %s cannot be used with %s", "FORCE_NULL",
+ "COPY TO")));
/* Don't allow the delimiter to appear in the null string. */
if (strchr(opts_out->null_print, opts_out->delim[0]) != NULL)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("COPY delimiter character must not appear in the NULL specification")));
+ /*- translator: %s is the name of a COPY option, e.g. NULL */
+ errmsg("COPY delimiter character must not appear in the %s specification",
+ "NULL")));
/* Don't allow the CSV quote char to appear in the null string. */
if (opts_out->csv_mode &&
strchr(opts_out->null_print, opts_out->quote[0]) != NULL)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("CSV quote character must not appear in the NULL specification")));
+ /*- translator: %s is the name of a COPY option, e.g. NULL */
+ errmsg("CSV quote character must not appear in the %s specification",
+ "NULL")));
/* Check freeze */
if (opts_out->freeze && !is_from)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("COPY FREEZE cannot be used with COPY TO")));
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
+ second %s is a COPY with direction, e.g. COPY TO */
+ errmsg("COPY %s cannot be used with %s", "FREEZE",
+ "COPY TO")));
if (opts_out->default_print)
{
if (!is_from)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY DEFAULT only available using COPY FROM")));
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
+ second %s is a COPY with direction, e.g. COPY TO */
+ errmsg("COPY %s cannot be used with %s", "DEFAULT",
+ "COPY TO")));
/* Don't allow the delimiter to appear in the default string. */
if (strchr(opts_out->default_print, opts_out->delim[0]) != NULL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("COPY delimiter must not appear in the DEFAULT specification")));
+ /*- translator: %s is the name of a COPY option, e.g. NULL */
+ errmsg("COPY delimiter character must not appear in the %s specification",
+ "DEFAULT")));
/* Don't allow the CSV quote char to appear in the default string. */
if (opts_out->csv_mode &&
strchr(opts_out->default_print, opts_out->quote[0]) != NULL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
- errmsg("CSV quote character must not appear in the DEFAULT specification")));
+ /*- translator: %s is the name of a COPY option, e.g. NULL */
+ errmsg("CSV quote character must not appear in the %s specification",
+ "DEFAULT")));
/* Don't allow the NULL and DEFAULT string to be the same */
if (opts_out->null_print_len == opts_out->default_print_len &&