Skip to content

Commit 517484b

Browse files
committed
Message style improvements
1 parent 8d98556 commit 517484b

29 files changed

+64
-68
lines changed

src/backend/access/transam/xlogprefetcher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ check_recovery_prefetch(int *new_value, void **extra, GucSource source)
10871087
#ifndef USE_PREFETCH
10881088
if (*new_value == RECOVERY_PREFETCH_ON)
10891089
{
1090-
GUC_check_errdetail("recovery_prefetch not supported on platforms that lack posix_fadvise().");
1090+
GUC_check_errdetail("recovery_prefetch is not supported on platforms that lack posix_fadvise().");
10911091
return false;
10921092
}
10931093
#endif

src/backend/access/transam/xlogreader.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,10 +1961,10 @@ XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id,
19611961
NULL))
19621962
{
19631963
#ifndef FRONTEND
1964-
elog(ERROR, "failed to locate backup block with ID %d in WAL record",
1964+
elog(ERROR, "could not locate backup block with ID %d in WAL record",
19651965
block_id);
19661966
#else
1967-
pg_fatal("failed to locate backup block with ID %d in WAL record",
1967+
pg_fatal("could not locate backup block with ID %d in WAL record",
19681968
block_id);
19691969
#endif
19701970
}

src/backend/backup/basebackup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ parse_basebackup_options(List *options, basebackup_options *opt)
862862
if (!parse_compress_algorithm(optval, &opt->compression))
863863
ereport(ERROR,
864864
(errcode(ERRCODE_SYNTAX_ERROR),
865-
errmsg("unrecognized compression algorithm \"%s\"",
865+
errmsg("unrecognized compression algorithm: \"%s\"",
866866
optval)));
867867
o_compression = true;
868868
}
@@ -918,7 +918,7 @@ parse_basebackup_options(List *options, basebackup_options *opt)
918918
if (o_compression_detail && !o_compression)
919919
ereport(ERROR,
920920
(errcode(ERRCODE_SYNTAX_ERROR),
921-
errmsg("compression detail requires compression")));
921+
errmsg("compression detail cannot be specified unless compression is enabled")));
922922

923923
if (o_compression)
924924
{

src/backend/backup/basebackup_server.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bbsink_server_new(bbsink *next, char *pathname)
7272
if (!has_privs_of_role(GetUserId(), ROLE_PG_WRITE_SERVER_FILES))
7373
ereport(ERROR,
7474
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
75-
errmsg("must be superuser or a role with privileges of the pg_write_server_files role to create server backup")));
75+
errmsg("must be superuser or a role with privileges of the pg_write_server_files role to create backup stored on server")));
7676
CommitTransactionCommand();
7777

7878
/*
@@ -86,7 +86,7 @@ bbsink_server_new(bbsink *next, char *pathname)
8686
if (!is_absolute_path(pathname))
8787
ereport(ERROR,
8888
(errcode(ERRCODE_INVALID_NAME),
89-
errmsg("relative path not allowed for server backup")));
89+
errmsg("relative path not allowed for backup stored on server")));
9090

9191
switch (pg_check_dir(pathname))
9292
{

src/backend/catalog/pg_publication.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,13 +513,13 @@ publication_translate_columns(Relation targetrel, List *columns,
513513
if (!AttrNumberIsForUserDefinedAttr(attnum))
514514
ereport(ERROR,
515515
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
516-
errmsg("cannot reference system column \"%s\" in publication column list",
516+
errmsg("cannot use system column \"%s\" in publication column list",
517517
colname));
518518

519519
if (TupleDescAttr(tupdesc, attnum - 1)->attgenerated)
520520
ereport(ERROR,
521521
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
522-
errmsg("cannot reference generated column \"%s\" in publication column list",
522+
errmsg("cannot use generated column \"%s\" in publication column list",
523523
colname));
524524

525525
if (bms_is_member(attnum, set))

src/backend/commands/dbcommands.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
991991
else
992992
ereport(ERROR,
993993
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
994-
errmsg("invalid create database strategy %s", strategy),
994+
errmsg("invalid create database strategy \"%s\"", strategy),
995995
errhint("Valid strategies are \"wal_log\", and \"file_copy\".")));
996996
}
997997

src/backend/commands/publicationcmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ check_simple_rowfilter_expr_walker(Node *node, ParseState *pstate)
575575
/* OK, supported */
576576
break;
577577
default:
578-
errdetail_msg = _("Expressions only allow columns, constants, built-in operators, built-in data types, built-in collations, and immutable built-in functions.");
578+
errdetail_msg = _("Only columns, constants, built-in operators, built-in data types, built-in collations, and immutable built-in functions are allowed.");
579579
break;
580580
}
581581

@@ -1359,7 +1359,7 @@ CheckAlterPublication(AlterPublicationStmt *stmt, HeapTuple tup,
13591359
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
13601360
errmsg("publication \"%s\" is defined as FOR ALL TABLES",
13611361
NameStr(pubform->pubname)),
1362-
errdetail("Tables from schema cannot be added to, dropped from, or set on FOR ALL TABLES publications.")));
1362+
errdetail("Schemas cannot be added to or dropped from FOR ALL TABLES publications.")));
13631363

13641364
/* Check that user is allowed to manipulate the publication tables. */
13651365
if (tables && pubform->puballtables)

src/backend/commands/subscriptioncmds.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,8 @@ check_publications(WalReceiverConn *wrconn, List *publications)
430430

431431
if (res->status != WALRCV_OK_TUPLES)
432432
ereport(ERROR,
433-
errmsg_plural("could not receive publication from the publisher: %s",
434-
"could not receive list of publications from the publisher: %s",
435-
list_length(publications),
436-
res->err));
433+
errmsg("could not receive list of publications from the publisher: %s",
434+
res->err));
437435

438436
publicationsCopy = list_copy(publications);
439437

src/backend/commands/trigger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ renametrig(RenameStmt *stmt)
15711571
ereport(ERROR,
15721572
errmsg("cannot rename trigger \"%s\" on table \"%s\"",
15731573
stmt->subname, RelationGetRelationName(targetrel)),
1574-
errhint("Rename trigger on partitioned table \"%s\" instead.",
1574+
errhint("Rename the trigger on the partitioned table \"%s\" instead.",
15751575
get_rel_name(get_partition_parent(relid, false))));
15761576

15771577

src/backend/executor/nodeModifyTable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,10 +2082,10 @@ ExecCrossPartitionUpdateForeignKey(ModifyTableContext *context,
20822082
ereport(ERROR,
20832083
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
20842084
errmsg("cannot move tuple across partitions when a non-root ancestor of the source partition is directly referenced in a foreign key"),
2085-
errdetail("A foreign key points to ancestor \"%s\", but not the root ancestor \"%s\".",
2085+
errdetail("A foreign key points to ancestor \"%s\" but not the root ancestor \"%s\".",
20862086
RelationGetRelationName(rInfo->ri_RelationDesc),
20872087
RelationGetRelationName(rootRelInfo->ri_RelationDesc)),
2088-
errhint("Consider defining the foreign key on \"%s\".",
2088+
errhint("Consider defining the foreign key on table \"%s\".",
20892089
RelationGetRelationName(rootRelInfo->ri_RelationDesc))));
20902090
}
20912091

src/backend/postmaster/pgarch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ LoadArchiveLibrary(void)
839839

840840
if (archive_init == NULL)
841841
ereport(ERROR,
842-
(errmsg("archive modules have to declare the _PG_archive_module_init symbol")));
842+
(errmsg("archive modules have to define the symbol %s", "_PG_archive_module_init")));
843843

844844
(*archive_init) (&ArchiveContext);
845845

src/backend/replication/logical/tablesync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
13201320
if (check_enable_rls(RelationGetRelid(rel), InvalidOid, false) == RLS_ENABLED)
13211321
ereport(ERROR,
13221322
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1323-
errmsg("\"%s\" cannot replicate into relation with row-level security enabled: \"%s\"",
1323+
errmsg("user \"%s\" cannot replicate into relation with row-level security enabled: \"%s\"",
13241324
GetUserNameFromId(GetUserId(), true),
13251325
RelationGetRelationName(rel))));
13261326

src/backend/replication/logical/worker.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ TargetPrivilegesCheck(Relation rel, AclMode mode)
16311631
if (check_enable_rls(relid, InvalidOid, false) == RLS_ENABLED)
16321632
ereport(ERROR,
16331633
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1634-
errmsg("\"%s\" cannot replicate into relation with row-level security enabled: \"%s\"",
1634+
errmsg("user \"%s\" cannot replicate into relation with row-level security enabled: \"%s\"",
16351635
GetUserNameFromId(GetUserId(), true),
16361636
RelationGetRelationName(rel))));
16371637
}
@@ -3788,7 +3788,7 @@ ApplyWorkerMain(Datum main_arg)
37883788
}
37893789

37903790
ereport(DEBUG1,
3791-
(errmsg("logical replication apply worker for subscription \"%s\" two_phase is %s",
3791+
(errmsg_internal("logical replication apply worker for subscription \"%s\" two_phase is %s",
37923792
MySubscription->name,
37933793
MySubscription->twophasestate == LOGICALREP_TWOPHASE_STATE_DISABLED ? "DISABLED" :
37943794
MySubscription->twophasestate == LOGICALREP_TWOPHASE_STATE_PENDING ? "PENDING" :
@@ -3837,7 +3837,7 @@ DisableSubscriptionAndExit(void)
38373837

38383838
/* Notify the subscription has been disabled and exit */
38393839
ereport(LOG,
3840-
errmsg("logical replication subscription \"%s\" has been disabled due to an error",
3840+
errmsg("subscription \"%s\" has been disabled because of an error",
38413841
MySubscription->name));
38423842

38433843
proc_exit(0);
@@ -3972,7 +3972,7 @@ clear_subscription_skip_lsn(XLogRecPtr finish_lsn)
39723972

39733973
if (myskiplsn != finish_lsn)
39743974
ereport(WARNING,
3975-
errmsg("skip-LSN of logical replication subscription \"%s\" cleared", MySubscription->name),
3975+
errmsg("skip-LSN of subscription \"%s\" cleared", MySubscription->name),
39763976
errdetail("Remote transaction's finish WAL location (LSN) %X/%X did not match skip-LSN %X/%X.",
39773977
LSN_FORMAT_ARGS(finish_lsn),
39783978
LSN_FORMAT_ARGS(myskiplsn)));
@@ -3999,31 +3999,31 @@ apply_error_callback(void *arg)
39993999
if (errarg->rel == NULL)
40004000
{
40014001
if (!TransactionIdIsValid(errarg->remote_xid))
4002-
errcontext("processing remote data for replication origin \"%s\" during \"%s\"",
4002+
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\"",
40034003
errarg->origin_name,
40044004
logicalrep_message_type(errarg->command));
40054005
else if (XLogRecPtrIsInvalid(errarg->finish_lsn))
4006-
errcontext("processing remote data for replication origin \"%s\" during \"%s\" in transaction %u",
4006+
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u",
40074007
errarg->origin_name,
40084008
logicalrep_message_type(errarg->command),
40094009
errarg->remote_xid);
40104010
else
4011-
errcontext("processing remote data for replication origin \"%s\" during \"%s\" in transaction %u finished at %X/%X",
4011+
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u, finished at %X/%X",
40124012
errarg->origin_name,
40134013
logicalrep_message_type(errarg->command),
40144014
errarg->remote_xid,
40154015
LSN_FORMAT_ARGS(errarg->finish_lsn));
40164016
}
40174017
else if (errarg->remote_attnum < 0)
4018-
errcontext("processing remote data for replication origin \"%s\" during \"%s\" for replication target relation \"%s.%s\" in transaction %u finished at %X/%X",
4018+
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",
40194019
errarg->origin_name,
40204020
logicalrep_message_type(errarg->command),
40214021
errarg->rel->remoterel.nspname,
40224022
errarg->rel->remoterel.relname,
40234023
errarg->remote_xid,
40244024
LSN_FORMAT_ARGS(errarg->finish_lsn));
40254025
else
4026-
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",
4026+
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",
40274027
errarg->origin_name,
40284028
logicalrep_message_type(errarg->command),
40294029
errarg->rel->remoterel.nspname,

src/backend/replication/walsender.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,8 @@ ReadReplicationSlot(ReadReplicationSlotCmd *cmd)
518518
if (OidIsValid(slot_contents.data.database))
519519
ereport(ERROR,
520520
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
521-
errmsg("cannot use \"%s\" with logical replication slot \"%s\"",
522-
"READ_REPLICATION_SLOT",
523-
NameStr(slot_contents.data.name)));
521+
errmsg("cannot use %s with a logical replication slot",
522+
"READ_REPLICATION_SLOT"));
524523

525524
/* slot type */
526525
values[i] = CStringGetTextDatum("physical");

src/backend/utils/activity/pgstat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ pgstat_discard_stats(void)
425425
{
426426
ereport(DEBUG2,
427427
(errcode_for_file_access(),
428-
errmsg("unlinked permanent statistics file \"%s\"",
428+
errmsg_internal("unlinked permanent statistics file \"%s\"",
429429
PGSTAT_STAT_PERMANENT_FILENAME)));
430430
}
431431

src/backend/utils/activity/pgstat_xact.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ pgstat_create_transactional(PgStat_Kind kind, Oid dboid, Oid objoid)
368368
if (pgstat_get_entry_ref(kind, dboid, objoid, false, NULL))
369369
{
370370
ereport(WARNING,
371-
errmsg("resetting existing stats for type %s, db=%u, oid=%u",
371+
errmsg("resetting existing statistics for kind %s, db=%u, oid=%u",
372372
(pgstat_get_kind_info(kind))->name, dboid, objoid));
373373

374374
pgstat_reset(kind, dboid, objoid);

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,9 @@ CreateBackupStreamer(char *archive_name, char *spclocation,
11191119
*/
11201120
if (inject_manifest && is_compressed_tar)
11211121
{
1122-
pg_log_error("cannot inject manifest into a compressed tarfile");
1123-
pg_log_info("use client-side compression, send the output to a directory rather than standard output, or use --no-manifest");
1122+
pg_log_error("cannot inject manifest into a compressed tar file");
1123+
pg_log_error_hint("Use client-side compression, send the output to a directory rather than standard output, or use %s.",
1124+
"--no-manifest");
11241125
exit(1);
11251126
}
11261127

@@ -1135,7 +1136,7 @@ CreateBackupStreamer(char *archive_name, char *spclocation,
11351136
/* At present, we only know how to parse tar archives. */
11361137
if (must_parse_archive && !is_tar && !is_compressed_tar)
11371138
{
1138-
pg_log_error("unable to parse archive: %s", archive_name);
1139+
pg_log_error("cannot parse archive \"%s\"", archive_name);
11391140
pg_log_error_detail("Only tar archives can be parsed.");
11401141
if (format == 'p')
11411142
pg_log_error_detail("Plain format requires pg_basebackup to parse the archive.");
@@ -1353,7 +1354,7 @@ ReceiveArchiveStreamChunk(size_t r, char *copybuf, void *callback_data)
13531354
/* Sanity check. */
13541355
if (state->manifest_buffer != NULL ||
13551356
state->manifest_file !=NULL)
1356-
pg_fatal("archives should precede manifest");
1357+
pg_fatal("archives must precede manifest");
13571358

13581359
/* Parse the rest of the CopyData message. */
13591360
archive_name = GetCopyDataString(r, copybuf, &cursor);
@@ -1799,7 +1800,7 @@ BaseBackup(char *compression_algorithm, char *compression_detail,
17991800
* Error message already written in CheckServerVersionForStreaming(),
18001801
* but add a hint about using -X none.
18011802
*/
1802-
pg_log_info("HINT: use -X none or -X fetch to disable log streaming");
1803+
pg_log_error_hint("Use -X none or -X fetch to disable log streaming.");
18031804
exit(1);
18041805
}
18051806

@@ -1911,7 +1912,7 @@ BaseBackup(char *compression_algorithm, char *compression_detail,
19111912

19121913
if (showprogress && !verbose)
19131914
{
1914-
fprintf(stderr, "waiting for checkpoint");
1915+
fprintf(stderr, _("waiting for checkpoint"));
19151916
if (isatty(fileno(stderr)))
19161917
fprintf(stderr, "\r");
19171918
else
@@ -2553,7 +2554,7 @@ main(int argc, char **argv)
25532554
char *error_detail;
25542555

25552556
if (!parse_compress_algorithm(compression_algorithm, &alg))
2556-
pg_fatal("unrecognized compression algorithm \"%s\"",
2557+
pg_fatal("unrecognized compression algorithm: \"%s\"",
25572558
compression_algorithm);
25582559

25592560
parse_compress_specification(alg, compression_detail, &client_compress);

src/bin/pg_basebackup/pg_receivewal.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -511,10 +511,8 @@ FindStreamingStart(uint32 *tli)
511511
continue;
512512
}
513513
#else
514-
pg_log_error("could not check file \"%s\"",
515-
dirent->d_name);
516-
pg_log_error_detail("This build does not support compression with %s.",
517-
"LZ4");
514+
pg_log_error("cannot check file \"%s\": compression with %s not supported by this build",
515+
dirent->d_name, "LZ4");
518516
exit(1);
519517
#endif
520518
}
@@ -867,7 +865,7 @@ main(int argc, char **argv)
867865
*/
868866
if (!parse_compress_algorithm(compression_algorithm_str,
869867
&compression_algorithm))
870-
pg_fatal("unrecognized compression algorithm \"%s\"",
868+
pg_fatal("unrecognized compression algorithm: \"%s\"",
871869
compression_algorithm_str);
872870

873871
parse_compress_specification(compression_algorithm, compression_detail,

src/bin/pg_basebackup/streamutil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ GetSlotInformation(PGconn *conn, const char *slot_name,
522522
*/
523523
if (PQgetisnull(res, 0, 0))
524524
{
525-
pg_log_error("could not find replication slot \"%s\"", slot_name);
525+
pg_log_error("replication slot \"%s\" does not exist", slot_name);
526526
PQclear(res);
527527
return false;
528528
}

src/bin/pg_basebackup/t/010_pg_basebackup.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
'failure if method "none" specified with compression level');
4545
$node->command_fails_like(
4646
[ 'pg_basebackup', '-D', "$tempdir/backup", '--compress', 'none+' ],
47-
qr/\Qunrecognized compression algorithm "none+"/,
47+
qr/\Qunrecognized compression algorithm: "none+"/,
4848
'failure on incorrect separator to define compression level');
4949

5050
# Some Windows ANSI code pages may reject this filename, in which case we
@@ -97,7 +97,7 @@
9797
my @compression_failure_tests = (
9898
[
9999
'extrasquishy',
100-
'unrecognized compression algorithm "extrasquishy"',
100+
'unrecognized compression algorithm: "extrasquishy"',
101101
'failure on invalid compression algorithm'
102102
],
103103
[
@@ -107,7 +107,7 @@
107107
],
108108
[
109109
'gzip:thunk',
110-
'invalid compression specification: unknown compression option "thunk"',
110+
'invalid compression specification: unrecognized compression option: "thunk"',
111111
'failure on unknown compression option'
112112
],
113113
[

src/bin/pg_basebackup/t/020_pg_receivewal.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@
251251
'nonexistentslot', '-n', '--no-sync', '--verbose',
252252
'--endpos', $nextlsn
253253
],
254-
qr/pg_receivewal: error: could not find replication slot "nonexistentslot"/,
254+
qr/pg_receivewal: error: replication slot "nonexistentslot" does not exist/,
255255
'pg_receivewal fails with non-existing slot');
256256
$primary->command_ok(
257257
[

src/bin/scripts/t/020_createdb.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
1,
144144
[qr/^$/],
145145
[
146-
qr/^createdb: error: database creation failed: ERROR: invalid create database strategy foo/s
146+
qr/^createdb: error: database creation failed: ERROR: invalid create database strategy "foo"/s
147147
],
148148
'createdb with incorrect --strategy');
149149

src/common/compression.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ parse_compress_specification(pg_compress_algorithm algorithm, char *specificatio
234234
}
235235
else
236236
result->parse_error =
237-
psprintf(_("unknown compression option \"%s\""), keyword);
237+
psprintf(_("unrecognized compression option: \"%s\""), keyword);
238238

239239
/* Release memory, just to be tidy. */
240240
pfree(keyword);

0 commit comments

Comments
 (0)