/*
* Extract the CopyFormatOptions.header_line value from a DefElem.
*
- * Parses the HEADER option for COPY, which can be a boolean, a non-negative
- * integer (number of lines to skip), or the special value "match".
+ * Parses the HEADER option for COPY, which can be a boolean, an integer greater
+ * than or equal to zero (number of lines to skip), or the special value
+ * "match".
*/
static int
defGetCopyHeaderOption(DefElem *def, bool is_from)
return COPY_HEADER_TRUE;
/*
- * Allow 0, 1, "true", "false", "on", "off", a non-negative integer, or
- * "match".
+ * Allow an integer value greater than or equal to zero, "true", "false",
+ * "on", "off", or "match".
*/
switch (nodeTag(def->arg))
{
}
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("%s requires a Boolean value, a non-negative integer, "
- "or the string \"match\"",
- def->defname)));
+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
+ second %s is the special value "match" for that option */
+ errmsg("%s requires a Boolean value, an integer value greater "
+ "than or equal to zero, or the string \"%s\"",
+ def->defname, "match")));
return COPY_HEADER_FALSE; /* keep compiler quiet */
}
copy header_copytest to stdout with (header match);
ERROR: cannot use "match" with HEADER in COPY TO
copy header_copytest from stdin with (header wrong_choice);
-ERROR: header requires a Boolean value, a non-negative integer, or the string "match"
+ERROR: header requires a Boolean value, an integer value greater than or equal to zero, or the string "match"
-- works
copy header_copytest from stdin with (header match);
copy header_copytest (c, a, b) from stdin with (header match);
COPY x from stdin with (header -1);
ERROR: a negative integer value cannot be specified for header
COPY x from stdin with (header 2.5);
-ERROR: header requires a Boolean value, a non-negative integer, or the string "match"
+ERROR: header requires a Boolean value, an integer value greater than or equal to zero, or the string "match"
COPY x to stdout with (header 2);
ERROR: cannot use multi-line header in COPY TO
-- too many columns in column list: should fail