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 | 498ee9ee2f4bc7d79f2d91cdd817b2a8f14a664f (patch) | |
tree | 862eaa3b98e0b87a8c8cfba86702c3c7a2d80e72 /src/backend/commands/copyfrom.c | |
parent | d0c8cf2a56fadb08705433bffb301559d97b0712 (diff) | |
download | postgresql-498ee9ee2f4bc7d79f2d91cdd817b2a8f14a664f.tar.gz postgresql-498ee9ee2f4bc7d79f2d91cdd817b2a8f14a664f.zip |
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 c42a5621d5a..ca85270be6d 100644 --- a/src/backend/commands/copyfrom.c +++ b/src/backend/commands/copyfrom.c @@ -1454,8 +1454,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; } } @@ -1496,8 +1497,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; } } |