postgres.git / summary / log / commit / refs

commit    28f9c5b5777bcb27de2e63a5feb41ec82d225992
Author:   Peter Eisentraut <peter@eisentraut.org>
Date:     Thu Aug 20 06:53:57 2026 +0000

    Unify error messages
    
    and some small style improvements


src/backend/commands/explain_state.c | 6 +++--- src/backend/commands/subscriptioncmds.c | 5 +++-- src/backend/commands/wait.c | 6 +++--- src/test/regress/expected/subscription.out | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/backend/commands/explain_state.c b/src/backend/commands/explain_state.c index a0ee0a664be..816f2797d7a 100644 --- a/src/backend/commands/explain_state.c +++ b/src/backend/commands/explain_state.c @@ -424,7 +424,7 @@ GUCCheckExplainExtensionOption(const char *option_name, } /* Unrecognized option name. */ - GUC_check_errmsg("unrecognized EXPLAIN option \"%s\"", option_name); + GUC_check_errmsg("unrecognized %s option \"%s\"", "EXPLAIN", option_name); return false; } @@ -489,8 +489,8 @@ GUCCheckBooleanExplainOption(const char *option_name, if (!valid) { - GUC_check_errmsg("EXPLAIN option \"%s\" requires a Boolean value", - option_name); + GUC_check_errmsg("%s option \"%s\" requires a Boolean value", + "EXPLAIN", option_name); return false; } diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index bbbe5ddc921..cff86dd57ab 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -360,7 +360,7 @@ parse_subscription_options(ParseState *pstate, List *stmt_options, if (opts->maxretention < 0) ereport(ERROR, errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("max_retention_duration cannot be negative")); + errmsg("option \"%s\" cannot be negative", "max_retention_duration")); } else if (IsSet(supported_opts, SUBOPT_ORIGIN) && strcmp(defel->defname, "origin") == 0) @@ -1895,7 +1895,8 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt, if (logicalrep_workers_find(subid, true, true)) ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), - errmsg("cannot alter retain_dead_tuples when logical replication worker is still running"), + errmsg("cannot alter option \"%s\" when logical replication worker is still running", + "retain_dead_tuples"), errhint("Try again after some time."))); /* diff --git a/src/backend/commands/wait.c b/src/backend/commands/wait.c index 40a6ffde16b..9ba4c75021e 100644 --- a/src/backend/commands/wait.c +++ b/src/backend/commands/wait.c @@ -302,21 +302,21 @@ ExecWaitStmt(ParseState *pstate, WaitStmt *stmt, bool isTopLevel, ereport(ERROR, errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("recovery is not in progress"), - errhint("Waiting for the standby_replay LSN can only be executed during recovery.")); + errhint("Waiting for the %s LSN can only be executed during recovery.", "standby_replay")); break; case WAIT_LSN_TYPE_STANDBY_WRITE: ereport(ERROR, errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("recovery is not in progress"), - errhint("Waiting for the standby_write LSN can only be executed during recovery.")); + errhint("Waiting for the %s LSN can only be executed during recovery.", "standby_write")); break; case WAIT_LSN_TYPE_STANDBY_FLUSH: ereport(ERROR, errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("recovery is not in progress"), - errhint("Waiting for the standby_flush LSN can only be executed during recovery.")); + errhint("Waiting for the %s LSN can only be executed during recovery.", "standby_flush")); break; default: diff --git a/src/test/regress/expected/subscription.out b/src/test/regress/expected/subscription.out index 7163b756787..9cf1aac7272 100644 --- a/src/test/regress/expected/subscription.out +++ b/src/test/regress/expected/subscription.out @@ -560,7 +560,7 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB ERROR: max_retention_duration requires an integer value -- fail - max_retention_duration must be non-negative CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, max_retention_duration = -1); -ERROR: max_retention_duration cannot be negative +ERROR: option "max_retention_duration" cannot be negative -- ok CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, max_retention_duration = 1000); NOTICE: max_retention_duration is ineffective when retain_dead_tuples is disabled @@ -575,7 +575,7 @@ HINT: To initiate replication, you must manually create the replication slot, e -- fail - max_retention_duration must be non-negative ALTER SUBSCRIPTION regress_testsub SET (max_retention_duration = -1); -ERROR: max_retention_duration cannot be negative +ERROR: option "max_retention_duration" cannot be negative -- ok ALTER SUBSCRIPTION regress_testsub SET (max_retention_duration = 0); \dRs+ [parent: 3861984342d8]