diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2024-08-08 15:17:11 -0400 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2024-08-08 15:17:11 -0400 |
commit | 28b953f26343105ebf3a1a212092e2c3c0bb0914 (patch) | |
tree | 07b53a0bfa6b309e11da6baf70db0121d89fa350 /src/backend/commands/copyfrom.c | |
parent | a7bf3e66852743503eb32cb38d93c0740dcca00a (diff) |
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 9f8377f7a279
(16-era), in whose development thread there was no discussion on this
point.
Backpatch to 17.
Diffstat (limited to 'src/backend/commands/copyfrom.c')
-rw-r--r-- | src/backend/commands/copyfrom.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c index ce4d62e707c..f25af1fa1e8 100644 --- a/src/backend/commands/copyfrom.c +++ b/src/backend/commands/copyfrom.c @@ -1444,8 +1444,9 @@ BeginCopyFrom(ParseState *pstate, if (!list_member_int(cstate->attnumlist, attnum)) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("FORCE_NOT_NULL column \"%s\" not referenced by COPY", - NameStr(attr->attname)))); + /*- translator: first %s is the name of a COPY option, e.g. FORCE_NOT_NULL */ + errmsg("%s column \"%s\" not referenced by COPY", + "FORCE_NOT_NULL", NameStr(attr->attname)))); cstate->opts.force_notnull_flags[attnum - 1] = true; } } @@ -1486,8 +1487,9 @@ BeginCopyFrom(ParseState *pstate, if (!list_member_int(cstate->attnumlist, attnum)) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("FORCE_NULL column \"%s\" not referenced by COPY", - NameStr(attr->attname)))); + /*- translator: first %s is the name of a COPY option, e.g. FORCE_NOT_NULL */ + errmsg("%s column \"%s\" not referenced by COPY", + "FORCE_NULL", NameStr(attr->attname)))); cstate->opts.force_null_flags[attnum - 1] = true; } } |