Skip to content

Commit 75445c1

Browse files
committed
1 parent 3f58cc6 commit 75445c1

File tree

12 files changed

+78
-51
lines changed

12 files changed

+78
-51
lines changed

src/backend/commands/copy.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,7 +2793,7 @@ CopyFrom(CopyState cstate)
27932793
{
27942794
ereport(ERROR,
27952795
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2796-
errmsg("cannot perform FREEZE on a partitioned table")));
2796+
errmsg("cannot perform COPY FREEZE on a partitioned table")));
27972797
}
27982798

27992799
/*
@@ -2808,13 +2808,13 @@ CopyFrom(CopyState cstate)
28082808
if (!ThereAreNoPriorRegisteredSnapshots() || !ThereAreNoReadyPortals())
28092809
ereport(ERROR,
28102810
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
2811-
errmsg("cannot perform FREEZE because of prior transaction activity")));
2811+
errmsg("cannot perform COPY FREEZE because of prior transaction activity")));
28122812

28132813
if (cstate->rel->rd_createSubid != GetCurrentSubTransactionId() &&
28142814
cstate->rel->rd_newRelfilenodeSubid != GetCurrentSubTransactionId())
28152815
ereport(ERROR,
28162816
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
2817-
errmsg("cannot perform FREEZE because the table was not created or truncated in the current subtransaction")));
2817+
errmsg("cannot perform COPY FREEZE because the table was not created or truncated in the current subtransaction")));
28182818

28192819
ti_options |= TABLE_INSERT_FROZEN;
28202820
}

src/backend/commands/publicationcmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ parse_publication_options(List *options,
129129
else
130130
ereport(ERROR,
131131
(errcode(ERRCODE_SYNTAX_ERROR),
132-
errmsg("unrecognized publication parameter: %s", defel->defname)));
132+
errmsg("unrecognized publication parameter: \"%s\"", defel->defname)));
133133
}
134134
}
135135

src/backend/commands/subscriptioncmds.c

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
185185
else
186186
ereport(ERROR,
187187
(errcode(ERRCODE_SYNTAX_ERROR),
188-
errmsg("unrecognized subscription parameter: %s", defel->defname)));
188+
errmsg("unrecognized subscription parameter: \"%s\"", defel->defname)));
189189
}
190190

191191
/*
@@ -198,17 +198,21 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
198198
if (enabled && *enabled_given && *enabled)
199199
ereport(ERROR,
200200
(errcode(ERRCODE_SYNTAX_ERROR),
201-
errmsg("connect = false and enabled = true are mutually exclusive options")));
201+
/*- translator: both %s are strings of the form "option = value" */
202+
errmsg("%s and %s are mutually exclusive options",
203+
"connect = false", "enabled = true")));
202204

203205
if (create_slot && create_slot_given && *create_slot)
204206
ereport(ERROR,
205207
(errcode(ERRCODE_SYNTAX_ERROR),
206-
errmsg("connect = false and create_slot = true are mutually exclusive options")));
208+
errmsg("%s and %s are mutually exclusive options",
209+
"connect = false", "create_slot = true")));
207210

208211
if (copy_data && copy_data_given && *copy_data)
209212
ereport(ERROR,
210213
(errcode(ERRCODE_SYNTAX_ERROR),
211-
errmsg("connect = false and copy_data = true are mutually exclusive options")));
214+
errmsg("%s and %s are mutually exclusive options",
215+
"connect = false", "copy_data = true")));
212216

213217
/* Change the defaults of other options. */
214218
*enabled = false;
@@ -225,22 +229,28 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
225229
if (enabled && *enabled_given && *enabled)
226230
ereport(ERROR,
227231
(errcode(ERRCODE_SYNTAX_ERROR),
228-
errmsg("slot_name = NONE and enabled = true are mutually exclusive options")));
232+
/*- translator: both %s are strings of the form "option = value" */
233+
errmsg("%s and %s are mutually exclusive options",
234+
"slot_name = NONE", "enable = true")));
229235

230236
if (create_slot && create_slot_given && *create_slot)
231237
ereport(ERROR,
232238
(errcode(ERRCODE_SYNTAX_ERROR),
233-
errmsg("slot_name = NONE and create_slot = true are mutually exclusive options")));
239+
errmsg("%s and %s are mutually exclusive options",
240+
"slot_name = NONE", "create_slot = true")));
234241

235242
if (enabled && !*enabled_given && *enabled)
236243
ereport(ERROR,
237244
(errcode(ERRCODE_SYNTAX_ERROR),
238-
errmsg("subscription with slot_name = NONE must also set enabled = false")));
245+
/*- translator: both %s are strings of the form "option = value" */
246+
errmsg("subscription with %s must also set %s",
247+
"slot_name = NONE", "enabled = false")));
239248

240249
if (create_slot && !create_slot_given && *create_slot)
241250
ereport(ERROR,
242251
(errcode(ERRCODE_SYNTAX_ERROR),
243-
errmsg("subscription with slot_name = NONE must also set create_slot = false")));
252+
errmsg("subscription with %s must also set %s",
253+
"slot_name = NONE", "create_slot = false")));
244254
}
245255
}
246256

@@ -487,9 +497,9 @@ CreateSubscription(CreateSubscriptionStmt *stmt, bool isTopLevel)
487497
}
488498
else
489499
ereport(WARNING,
490-
(errmsg("tables were not subscribed, you will have to run "
491-
"ALTER SUBSCRIPTION ... REFRESH PUBLICATION to "
492-
"subscribe the tables")));
500+
/* translator: %s is an SQL ALTER statement */
501+
(errmsg("tables were not subscribed, you will have to run %s to subscribe the tables",
502+
"ALTER SUBSCRIPTION ... REFRESH PUBLICATION")));
493503

494504
table_close(rel, RowExclusiveLock);
495505

@@ -673,7 +683,8 @@ AlterSubscription(AlterSubscriptionStmt *stmt)
673683
if (sub->enabled && !slotname)
674684
ereport(ERROR,
675685
(errcode(ERRCODE_SYNTAX_ERROR),
676-
errmsg("cannot set slot_name = NONE for enabled subscription")));
686+
errmsg("cannot set %s for enabled subscription",
687+
"slot_name = NONE")));
677688

678689
if (slotname)
679690
values[Anum_pg_subscription_subslotname - 1] =
@@ -981,8 +992,9 @@ DropSubscription(DropSubscriptionStmt *stmt, bool isTopLevel)
981992
(errmsg("could not connect to publisher when attempting to "
982993
"drop the replication slot \"%s\"", slotname),
983994
errdetail("The error was: %s", err),
984-
errhint("Use ALTER SUBSCRIPTION ... SET (slot_name = NONE) "
985-
"to disassociate the subscription from the slot.")));
995+
/* translator: %s is an SQL ALTER command */
996+
errhint("Use %s to disassociate the subscription from the slot.",
997+
"ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));
986998

987999
PG_TRY();
9881000
{

src/backend/commands/tablecmds.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15116,14 +15116,14 @@ ComputePartitionAttrs(ParseState *pstate, Relation rel, List *partParams, AttrNu
1511615116
if (strategy == PARTITION_STRATEGY_HASH)
1511715117
ereport(ERROR,
1511815118
(errcode(ERRCODE_UNDEFINED_OBJECT),
15119-
errmsg("data type %s has no default hash operator class",
15120-
format_type_be(atttype)),
15119+
errmsg("data type %s has no default operator class for access method \"%s\"",
15120+
format_type_be(atttype), "hash"),
1512115121
errhint("You must specify a hash operator class or define a default hash operator class for the data type.")));
1512215122
else
1512315123
ereport(ERROR,
1512415124
(errcode(ERRCODE_UNDEFINED_OBJECT),
15125-
errmsg("data type %s has no default btree operator class",
15126-
format_type_be(atttype)),
15125+
errmsg("data type %s has no default operator class for access method \"%s\"",
15126+
format_type_be(atttype), "btree"),
1512715127
errhint("You must specify a btree operator class or define a default btree operator class for the data type.")));
1512815128

1512915129
}

src/backend/parser/analyze.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2599,7 +2599,7 @@ transformCreateTableAsStmt(ParseState *pstate, CreateTableAsStmt *stmt)
25992599
if (stmt->into->rel->relpersistence == RELPERSISTENCE_UNLOGGED)
26002600
ereport(ERROR,
26012601
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2602-
errmsg("materialized views cannot be UNLOGGED")));
2602+
errmsg("materialized views cannot be unlogged")));
26032603

26042604
/*
26052605
* At runtime, we'll need a copy of the parsed-but-not-rewritten Query

src/backend/postmaster/postmaster.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,7 +2028,7 @@ ProcessStartupPacket(Port *port, bool secure_done)
20282028
continue;
20292029
ereport(COMMERROR,
20302030
(errcode_for_socket_access(),
2031-
errmsg("failed to send GSSAPI negotiation response: %m)")));
2031+
errmsg("failed to send GSSAPI negotiation response: %m")));
20322032
return STATUS_ERROR; /* close the connection */
20332033
}
20342034

@@ -2651,11 +2651,12 @@ SIGHUP_handler(SIGNAL_ARGS)
26512651
/* Reload authentication config files too */
26522652
if (!load_hba())
26532653
ereport(LOG,
2654-
(errmsg("pg_hba.conf was not reloaded")));
2654+
/* translator: %s is a configuration file */
2655+
(errmsg("%s was not reloaded", "pg_hba.conf")));
26552656

26562657
if (!load_ident())
26572658
ereport(LOG,
2658-
(errmsg("pg_ident.conf was not reloaded")));
2659+
(errmsg("%s was not reloaded", "pg_ident.conf")));
26592660

26602661
#ifdef USE_SSL
26612662
/* Reload SSL configuration as well */

src/backend/replication/walsender.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -903,32 +903,37 @@ CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
903903
{
904904
if (IsTransactionBlock())
905905
ereport(ERROR,
906-
(errmsg("CREATE_REPLICATION_SLOT ... EXPORT_SNAPSHOT "
907-
"must not be called inside a transaction")));
906+
/*- translator: %s is a CREATE_REPLICATION_SLOT statement */
907+
(errmsg("%s must not be called inside a transaction",
908+
"CREATE_REPLICATION_SLOT ... EXPORT_SNAPSHOT")));
908909

909910
need_full_snapshot = true;
910911
}
911912
else if (snapshot_action == CRS_USE_SNAPSHOT)
912913
{
913914
if (!IsTransactionBlock())
914915
ereport(ERROR,
915-
(errmsg("CREATE_REPLICATION_SLOT ... USE_SNAPSHOT "
916-
"must be called inside a transaction")));
916+
/*- translator: %s is a CREATE_REPLICATION_SLOT statement */
917+
(errmsg("%s must be called inside a transaction",
918+
"CREATE_REPLICATION_SLOT ... USE_SNAPSHOT")));
917919

918920
if (XactIsoLevel != XACT_REPEATABLE_READ)
919921
ereport(ERROR,
920-
(errmsg("CREATE_REPLICATION_SLOT ... USE_SNAPSHOT "
921-
"must be called in REPEATABLE READ isolation mode transaction")));
922+
/*- translator: %s is a CREATE_REPLICATION_SLOT statement */
923+
(errmsg("%s must be called in REPEATABLE READ isolation mode transaction",
924+
"CREATE_REPLICATION_SLOT ... USE_SNAPSHOT")));
922925

923926
if (FirstSnapshotSet)
924927
ereport(ERROR,
925-
(errmsg("CREATE_REPLICATION_SLOT ... USE_SNAPSHOT "
926-
"must be called before any query")));
928+
/*- translator: %s is a CREATE_REPLICATION_SLOT statement */
929+
(errmsg("%s must be called before any query",
930+
"CREATE_REPLICATION_SLOT ... USE_SNAPSHOT")));
927931

928932
if (IsSubTransaction())
929933
ereport(ERROR,
930-
(errmsg("CREATE_REPLICATION_SLOT ... USE_SNAPSHOT "
931-
"must not be called in a subtransaction")));
934+
/*- translator: %s is a CREATE_REPLICATION_SLOT statement */
935+
(errmsg("%s must not be called in a subtransaction",
936+
"CREATE_REPLICATION_SLOT ... USE_SNAPSHOT")));
932937

933938
need_full_snapshot = true;
934939
}

src/backend/utils/adt/jsonpath.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ jsonPathFromCstring(char *in, int len)
179179
if (!jsonpath)
180180
ereport(ERROR,
181181
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
182-
errmsg("invalid input syntax for jsonpath: \"%s\"", in)));
182+
errmsg("invalid input syntax for type %s: \"%s\"", "jsonpath",
183+
in)));
183184

184185
flattenJsonPathParseItem(&buf, jsonpath->expr, 0, false);
185186

src/backend/utils/adt/jsonpath_exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,7 @@ getJsonPathVariable(JsonPathExecContext *cxt, JsonPathItem *variable,
19341934
{
19351935
ereport(ERROR,
19361936
(errcode(ERRCODE_UNDEFINED_OBJECT),
1937-
errmsg("cannot find jsonpath variable \"%s\"",
1937+
errmsg("could not find jsonpath variable \"%s\"",
19381938
pnstrdup(varName, varNameLength))));
19391939
}
19401940

src/backend/utils/adt/jsonpath_scan.l

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ addUnicodeChar(int ch)
539539
{
540540
ereport(ERROR,
541541
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
542-
errmsg("invalid input syntax for type jsonpath"),
542+
errmsg("invalid input syntax for type %s", "jsonpath"),
543543
errdetail("Unicode escape values cannot be used for code "
544544
"point values above 007F when the server encoding "
545545
"is not UTF8.")));
@@ -555,7 +555,7 @@ addUnicode(int ch, int *hi_surrogate)
555555
if (*hi_surrogate != -1)
556556
ereport(ERROR,
557557
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
558-
errmsg("invalid input syntax for type jsonpath"),
558+
errmsg("invalid input syntax for type %s", "jsonpath"),
559559
errdetail("Unicode high surrogate must not follow "
560560
"a high surrogate.")));
561561
*hi_surrogate = (ch & 0x3ff) << 10;
@@ -566,7 +566,7 @@ addUnicode(int ch, int *hi_surrogate)
566566
if (*hi_surrogate == -1)
567567
ereport(ERROR,
568568
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
569-
errmsg("invalid input syntax for type jsonpath"),
569+
errmsg("invalid input syntax for type %s", "jsonpath"),
570570
errdetail("Unicode low surrogate must follow a high "
571571
"surrogate.")));
572572
ch = 0x10000 + *hi_surrogate + (ch & 0x3ff);
@@ -576,7 +576,7 @@ addUnicode(int ch, int *hi_surrogate)
576576
{
577577
ereport(ERROR,
578578
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
579-
errmsg("invalid input syntax for type jsonpath"),
579+
errmsg("invalid input syntax for type %s", "jsonpath"),
580580
errdetail("Unicode low surrogate must follow a high "
581581
"surrogate.")));
582582
}
@@ -618,7 +618,7 @@ parseUnicode(char *s, int l)
618618
{
619619
ereport(ERROR,
620620
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
621-
errmsg("invalid input syntax for type jsonpath"),
621+
errmsg("invalid input syntax for type %s", "jsonpath"),
622622
errdetail("Unicode low surrogate must follow a high "
623623
"surrogate.")));
624624
}

src/backend/utils/adt/pg_locale.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ icu_to_uchar(UChar **buff_uchar, const char *buff, size_t nbytes)
16031603
buff, nbytes, &status);
16041604
if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
16051605
ereport(ERROR,
1606-
(errmsg("ucnv_toUChars failed: %s", u_errorName(status))));
1606+
(errmsg("%s failed: %s", "ucnv_toUChars", u_errorName(status))));
16071607

16081608
*buff_uchar = palloc((len_uchar + 1) * sizeof(**buff_uchar));
16091609

@@ -1612,7 +1612,7 @@ icu_to_uchar(UChar **buff_uchar, const char *buff, size_t nbytes)
16121612
buff, nbytes, &status);
16131613
if (U_FAILURE(status))
16141614
ereport(ERROR,
1615-
(errmsg("ucnv_toUChars failed: %s", u_errorName(status))));
1615+
(errmsg("%s failed: %s", "ucnv_toUChars", u_errorName(status))));
16161616

16171617
return len_uchar;
16181618
}
@@ -1641,7 +1641,8 @@ icu_from_uchar(char **result, const UChar *buff_uchar, int32_t len_uchar)
16411641
buff_uchar, len_uchar, &status);
16421642
if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
16431643
ereport(ERROR,
1644-
(errmsg("ucnv_fromUChars failed: %s", u_errorName(status))));
1644+
(errmsg("%s failed: %s", "ucnv_fromUChars",
1645+
u_errorName(status))));
16451646

16461647
*result = palloc(len_result + 1);
16471648

@@ -1650,7 +1651,8 @@ icu_from_uchar(char **result, const UChar *buff_uchar, int32_t len_uchar)
16501651
buff_uchar, len_uchar, &status);
16511652
if (U_FAILURE(status))
16521653
ereport(ERROR,
1653-
(errmsg("ucnv_fromUChars failed: %s", u_errorName(status))));
1654+
(errmsg("%s failed: %s", "ucnv_fromUChars",
1655+
u_errorName(status))));
16541656

16551657
return len_result;
16561658
}

src/backend/utils/adt/regexp.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ parse_re_flags(pg_re_flags *flags, text *opts)
423423
default:
424424
ereport(ERROR,
425425
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
426-
errmsg("invalid regexp option: \"%c\"",
426+
errmsg("invalid regular expression option: \"%c\"",
427427
opt_p[i])));
428428
break;
429429
}
@@ -920,7 +920,9 @@ regexp_match(PG_FUNCTION_ARGS)
920920
if (re_flags.glob)
921921
ereport(ERROR,
922922
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
923-
errmsg("regexp_match does not support the global option"),
923+
/* translator: %s is a SQL function name */
924+
errmsg("%s does not support the \"global\" option",
925+
"regexp_match()"),
924926
errhint("Use the regexp_matches function instead.")));
925927

926928
matchctx = setup_regexp_matches(orig_str, pattern, &re_flags,
@@ -1298,7 +1300,9 @@ regexp_split_to_table(PG_FUNCTION_ARGS)
12981300
if (re_flags.glob)
12991301
ereport(ERROR,
13001302
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1301-
errmsg("regexp_split_to_table does not support the global option")));
1303+
/* translator: %s is a SQL function name */
1304+
errmsg("%s does not support the \"global\" option",
1305+
"regexp_split_to_table()")));
13021306
/* But we find all the matches anyway */
13031307
re_flags.glob = true;
13041308

@@ -1351,7 +1355,9 @@ regexp_split_to_array(PG_FUNCTION_ARGS)
13511355
if (re_flags.glob)
13521356
ereport(ERROR,
13531357
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1354-
errmsg("regexp_split_to_array does not support the global option")));
1358+
/* translator: %s is a SQL function name */
1359+
errmsg("%s does not support the \"global\" option",
1360+
"regexp_split_to_array()")));
13551361
/* But we find all the matches anyway */
13561362
re_flags.glob = true;
13571363

0 commit comments

Comments
 (0)