From 26f7802beb2a4aafa0903f5bedeb7f1fa6f4f358 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 24 Sep 2022 18:38:35 -0400 Subject: Message style improvements --- src/backend/access/transam/xlogprefetcher.c | 2 +- src/backend/access/transam/xlogreader.c | 4 ++-- src/backend/backup/basebackup.c | 4 ++-- src/backend/backup/basebackup_server.c | 4 ++-- src/backend/catalog/pg_publication.c | 4 ++-- src/backend/commands/dbcommands.c | 2 +- src/backend/commands/publicationcmds.c | 4 ++-- src/backend/commands/subscriptioncmds.c | 6 ++---- src/backend/commands/trigger.c | 2 +- src/backend/executor/nodeModifyTable.c | 4 ++-- src/backend/postmaster/pgarch.c | 2 +- src/backend/replication/logical/tablesync.c | 2 +- src/backend/replication/logical/worker.c | 18 +++++++++--------- src/backend/replication/walsender.c | 5 ++--- src/backend/utils/activity/pgstat.c | 2 +- src/backend/utils/activity/pgstat_xact.c | 2 +- 16 files changed, 32 insertions(+), 35 deletions(-) (limited to 'src/backend') diff --git a/src/backend/access/transam/xlogprefetcher.c b/src/backend/access/transam/xlogprefetcher.c index 342960263cb..8f5d4253320 100644 --- a/src/backend/access/transam/xlogprefetcher.c +++ b/src/backend/access/transam/xlogprefetcher.c @@ -1089,7 +1089,7 @@ check_recovery_prefetch(int *new_value, void **extra, GucSource source) #ifndef USE_PREFETCH if (*new_value == RECOVERY_PREFETCH_ON) { - GUC_check_errdetail("recovery_prefetch not supported on platforms that lack posix_fadvise()."); + GUC_check_errdetail("recovery_prefetch is not supported on platforms that lack posix_fadvise()."); return false; } #endif diff --git a/src/backend/access/transam/xlogreader.c b/src/backend/access/transam/xlogreader.c index c1c9f1995bc..4d6c34e0fc5 100644 --- a/src/backend/access/transam/xlogreader.c +++ b/src/backend/access/transam/xlogreader.c @@ -1963,10 +1963,10 @@ XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id, blknum, NULL)) { #ifndef FRONTEND - elog(ERROR, "failed to locate backup block with ID %d in WAL record", + elog(ERROR, "could not locate backup block with ID %d in WAL record", block_id); #else - pg_fatal("failed to locate backup block with ID %d in WAL record", + pg_fatal("could not locate backup block with ID %d in WAL record", block_id); #endif } diff --git a/src/backend/backup/basebackup.c b/src/backend/backup/basebackup.c index dd103a8689f..459de55cb4a 100644 --- a/src/backend/backup/basebackup.c +++ b/src/backend/backup/basebackup.c @@ -863,7 +863,7 @@ parse_basebackup_options(List *options, basebackup_options *opt) if (!parse_compress_algorithm(optval, &opt->compression)) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("unrecognized compression algorithm \"%s\"", + errmsg("unrecognized compression algorithm: \"%s\"", optval))); o_compression = true; } @@ -919,7 +919,7 @@ parse_basebackup_options(List *options, basebackup_options *opt) if (o_compression_detail && !o_compression) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("compression detail requires compression"))); + errmsg("compression detail cannot be specified unless compression is enabled"))); if (o_compression) { diff --git a/src/backend/backup/basebackup_server.c b/src/backend/backup/basebackup_server.c index d020a92bfab..0258d7a03b3 100644 --- a/src/backend/backup/basebackup_server.c +++ b/src/backend/backup/basebackup_server.c @@ -72,7 +72,7 @@ bbsink_server_new(bbsink *next, char *pathname) if (!has_privs_of_role(GetUserId(), ROLE_PG_WRITE_SERVER_FILES)) ereport(ERROR, (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - errmsg("must be superuser or a role with privileges of the pg_write_server_files role to create server backup"))); + errmsg("must be superuser or a role with privileges of the pg_write_server_files role to create backup stored on server"))); CommitTransactionCommand(); /* @@ -86,7 +86,7 @@ bbsink_server_new(bbsink *next, char *pathname) if (!is_absolute_path(pathname)) ereport(ERROR, (errcode(ERRCODE_INVALID_NAME), - errmsg("relative path not allowed for server backup"))); + errmsg("relative path not allowed for backup stored on server"))); switch (pg_check_dir(pathname)) { diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c index cd48cb6c469..59967098b3f 100644 --- a/src/backend/catalog/pg_publication.c +++ b/src/backend/catalog/pg_publication.c @@ -513,13 +513,13 @@ publication_translate_columns(Relation targetrel, List *columns, if (!AttrNumberIsForUserDefinedAttr(attnum)) ereport(ERROR, errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("cannot reference system column \"%s\" in publication column list", + errmsg("cannot use system column \"%s\" in publication column list", colname)); if (TupleDescAttr(tupdesc, attnum - 1)->attgenerated) ereport(ERROR, errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("cannot reference generated column \"%s\" in publication column list", + errmsg("cannot use generated column \"%s\" in publication column list", colname)); if (bms_is_member(attnum, set)) diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index e0753c1badc..96b46cbc020 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -992,7 +992,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("invalid create database strategy %s", strategy), + errmsg("invalid create database strategy \"%s\"", strategy), errhint("Valid strategies are \"wal_log\", and \"file_copy\"."))); } diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c index 7ffad096aa1..99011eec9fa 100644 --- a/src/backend/commands/publicationcmds.c +++ b/src/backend/commands/publicationcmds.c @@ -575,7 +575,7 @@ check_simple_rowfilter_expr_walker(Node *node, ParseState *pstate) /* OK, supported */ break; default: - errdetail_msg = _("Expressions only allow columns, constants, built-in operators, built-in data types, built-in collations, and immutable built-in functions."); + errdetail_msg = _("Only columns, constants, built-in operators, built-in data types, built-in collations, and immutable built-in functions are allowed."); break; } @@ -1359,7 +1359,7 @@ CheckAlterPublication(AlterPublicationStmt *stmt, HeapTuple tup, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("publication \"%s\" is defined as FOR ALL TABLES", NameStr(pubform->pubname)), - errdetail("Tables from schema cannot be added to, dropped from, or set on FOR ALL TABLES publications."))); + errdetail("Schemas cannot be added to or dropped from FOR ALL TABLES publications."))); /* Check that user is allowed to manipulate the publication tables. */ if (tables && pubform->puballtables) diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index d042abe3414..f3bfcca434c 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -461,10 +461,8 @@ check_publications(WalReceiverConn *wrconn, List *publications) if (res->status != WALRCV_OK_TUPLES) ereport(ERROR, - errmsg_plural("could not receive publication from the publisher: %s", - "could not receive list of publications from the publisher: %s", - list_length(publications), - res->err)); + errmsg("could not receive list of publications from the publisher: %s", + res->err)); publicationsCopy = list_copy(publications); diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 6f5a5262c73..0ec8d84a1b5 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -1532,7 +1532,7 @@ renametrig(RenameStmt *stmt) ereport(ERROR, errmsg("cannot rename trigger \"%s\" on table \"%s\"", stmt->subname, RelationGetRelationName(targetrel)), - errhint("Rename trigger on partitioned table \"%s\" instead.", + errhint("Rename the trigger on the partitioned table \"%s\" instead.", get_rel_name(get_partition_parent(relid, false)))); diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index deda3215028..775960827d0 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -2082,10 +2082,10 @@ ExecCrossPartitionUpdateForeignKey(ModifyTableContext *context, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot move tuple across partitions when a non-root ancestor of the source partition is directly referenced in a foreign key"), - errdetail("A foreign key points to ancestor \"%s\", but not the root ancestor \"%s\".", + errdetail("A foreign key points to ancestor \"%s\" but not the root ancestor \"%s\".", RelationGetRelationName(rInfo->ri_RelationDesc), RelationGetRelationName(rootRelInfo->ri_RelationDesc)), - errhint("Consider defining the foreign key on \"%s\".", + errhint("Consider defining the foreign key on table \"%s\".", RelationGetRelationName(rootRelInfo->ri_RelationDesc)))); } diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c index 6ce361707d7..3868cd7bd35 100644 --- a/src/backend/postmaster/pgarch.c +++ b/src/backend/postmaster/pgarch.c @@ -851,7 +851,7 @@ LoadArchiveLibrary(void) if (archive_init == NULL) ereport(ERROR, - (errmsg("archive modules have to declare the _PG_archive_module_init symbol"))); + (errmsg("archive modules have to define the symbol %s", "_PG_archive_module_init"))); (*archive_init) (&ArchiveContext); diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index 8eff69c7dec..9e52fc401cc 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -1361,7 +1361,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos) if (check_enable_rls(RelationGetRelid(rel), InvalidOid, false) == RLS_ENABLED) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("\"%s\" cannot replicate into relation with row-level security enabled: \"%s\"", + errmsg("user \"%s\" cannot replicate into relation with row-level security enabled: \"%s\"", GetUserNameFromId(GetUserId(), true), RelationGetRelationName(rel)))); diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 56f753d987d..207a5805ba7 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -1632,7 +1632,7 @@ TargetPrivilegesCheck(Relation rel, AclMode mode) if (check_enable_rls(relid, InvalidOid, false) == RLS_ENABLED) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("\"%s\" cannot replicate into relation with row-level security enabled: \"%s\"", + errmsg("user \"%s\" cannot replicate into relation with row-level security enabled: \"%s\"", GetUserNameFromId(GetUserId(), true), RelationGetRelationName(rel)))); } @@ -3791,7 +3791,7 @@ ApplyWorkerMain(Datum main_arg) } ereport(DEBUG1, - (errmsg("logical replication apply worker for subscription \"%s\" two_phase is %s", + (errmsg_internal("logical replication apply worker for subscription \"%s\" two_phase is %s", MySubscription->name, MySubscription->twophasestate == LOGICALREP_TWOPHASE_STATE_DISABLED ? "DISABLED" : MySubscription->twophasestate == LOGICALREP_TWOPHASE_STATE_PENDING ? "PENDING" : @@ -3840,7 +3840,7 @@ DisableSubscriptionAndExit(void) /* Notify the subscription has been disabled and exit */ ereport(LOG, - errmsg("logical replication subscription \"%s\" has been disabled due to an error", + errmsg("subscription \"%s\" has been disabled because of an error", MySubscription->name)); proc_exit(0); @@ -3975,7 +3975,7 @@ clear_subscription_skip_lsn(XLogRecPtr finish_lsn) if (myskiplsn != finish_lsn) ereport(WARNING, - errmsg("skip-LSN of logical replication subscription \"%s\" cleared", MySubscription->name), + errmsg("skip-LSN of subscription \"%s\" cleared", MySubscription->name), errdetail("Remote transaction's finish WAL location (LSN) %X/%X did not match skip-LSN %X/%X.", LSN_FORMAT_ARGS(finish_lsn), LSN_FORMAT_ARGS(myskiplsn))); @@ -4002,23 +4002,23 @@ apply_error_callback(void *arg) if (errarg->rel == NULL) { if (!TransactionIdIsValid(errarg->remote_xid)) - errcontext("processing remote data for replication origin \"%s\" during \"%s\"", + errcontext("processing remote data for replication origin \"%s\" during message type \"%s\"", errarg->origin_name, logicalrep_message_type(errarg->command)); else if (XLogRecPtrIsInvalid(errarg->finish_lsn)) - errcontext("processing remote data for replication origin \"%s\" during \"%s\" in transaction %u", + errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u", errarg->origin_name, logicalrep_message_type(errarg->command), errarg->remote_xid); else - errcontext("processing remote data for replication origin \"%s\" during \"%s\" in transaction %u finished at %X/%X", + errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u, finished at %X/%X", errarg->origin_name, logicalrep_message_type(errarg->command), errarg->remote_xid, LSN_FORMAT_ARGS(errarg->finish_lsn)); } else if (errarg->remote_attnum < 0) - errcontext("processing remote data for replication origin \"%s\" during \"%s\" for replication target relation \"%s.%s\" in transaction %u finished at %X/%X", + errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" in transaction %u, finished at %X/%X", errarg->origin_name, logicalrep_message_type(errarg->command), errarg->rel->remoterel.nspname, @@ -4026,7 +4026,7 @@ apply_error_callback(void *arg) errarg->remote_xid, LSN_FORMAT_ARGS(errarg->finish_lsn)); else - errcontext("processing remote data for replication origin \"%s\" during \"%s\" for replication target relation \"%s.%s\" column \"%s\" in transaction %u finished at %X/%X", + errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" for replication target relation \"%s.%s\" column \"%s\" in transaction %u, finished at %X/%X", errarg->origin_name, logicalrep_message_type(errarg->command), errarg->rel->remoterel.nspname, diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index 724010dbd97..e9ba500a15f 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -516,9 +516,8 @@ ReadReplicationSlot(ReadReplicationSlotCmd *cmd) if (OidIsValid(slot_contents.data.database)) ereport(ERROR, errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cannot use \"%s\" with logical replication slot \"%s\"", - "READ_REPLICATION_SLOT", - NameStr(slot_contents.data.name))); + errmsg("cannot use %s with a logical replication slot", + "READ_REPLICATION_SLOT")); /* slot type */ values[i] = CStringGetTextDatum("physical"); diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c index 9e3b643a2cd..609f0b1ad86 100644 --- a/src/backend/utils/activity/pgstat.c +++ b/src/backend/utils/activity/pgstat.c @@ -425,7 +425,7 @@ pgstat_discard_stats(void) { ereport(DEBUG2, (errcode_for_file_access(), - errmsg("unlinked permanent statistics file \"%s\"", + errmsg_internal("unlinked permanent statistics file \"%s\"", PGSTAT_STAT_PERMANENT_FILENAME))); } diff --git a/src/backend/utils/activity/pgstat_xact.c b/src/backend/utils/activity/pgstat_xact.c index 82eb59af834..d6f660edf7b 100644 --- a/src/backend/utils/activity/pgstat_xact.c +++ b/src/backend/utils/activity/pgstat_xact.c @@ -368,7 +368,7 @@ pgstat_create_transactional(PgStat_Kind kind, Oid dboid, Oid objoid) if (pgstat_get_entry_ref(kind, dboid, objoid, false, NULL)) { ereport(WARNING, - errmsg("resetting existing stats for type %s, db=%u, oid=%u", + errmsg("resetting existing statistics for kind %s, db=%u, oid=%u", (pgstat_get_kind_info(kind))->name, dboid, objoid)); pgstat_reset(kind, dboid, objoid); -- cgit v1.2.3