1
0
mirror of https://github.com/postgres/postgres.git synced 2026-10-23 13:29:09 +03:00

Unify error messages

and some small style improvements
This commit is contained in:
Peter Eisentraut
2026-08-20 08:53:57 +02:00
parent 3861984342
commit 28f9c5b577
4 changed files with 11 additions and 10 deletions

View File

@@ -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;
}

View File

@@ -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.")));
/*

View File

@@ -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:

View File

@@ -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+