mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Refactor error messages to reduce duplication
I also took the liberty of changing
errmsg("COPY DEFAULT only available using COPY FROM")
to
errmsg("COPY %s cannot be used with %s", "DEFAULT", "COPY TO")
because the original wording is unlike all other messages that indicate
option incompatibility. This message was added by commit 9f8377f7a2
(16-era), in whose development thread there was no discussion on this
point.
Backpatch to 17.
This commit is contained in:
@@ -593,8 +593,9 @@ BeginCopyTo(ParseState *pstate,
|
||||
if (!list_member_int(cstate->attnumlist, attnum))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
|
||||
errmsg("FORCE_QUOTE column \"%s\" not referenced by COPY",
|
||||
NameStr(attr->attname))));
|
||||
/*- translator: %s is the name of a COPY option, e.g. FORCE_NOT_NULL */
|
||||
errmsg("%s column \"%s\" not referenced by COPY",
|
||||
"FORCE_QUOTE", NameStr(attr->attname))));
|
||||
cstate->opts.force_quote_flags[attnum - 1] = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user