Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 26f7802

Browse files
committed
Message style improvements
1 parent a6bc330 commit 26f7802

29 files changed

+64
-68
lines changed

src/backend/access/transam/xlogprefetcher.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ check_recovery_prefetch(int *new_value, void **extra, GucSource source)
10891089
#ifndef USE_PREFETCH
10901090
if (*new_value == RECOVERY_PREFETCH_ON)
10911091
{
1092-
GUC_check_errdetail("recovery_prefetch not supported on platforms that lack posix_fadvise().");
1092+
GUC_check_errdetail("recovery_prefetch is not supported on platforms that lack posix_fadvise().");
10931093
return false;
10941094
}
10951095
#endif

src/backend/access/transam/xlogreader.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1963,10 +1963,10 @@ XLogRecGetBlockTag(XLogReaderState *record, uint8 block_id,
19631963
blknum, NULL))
19641964
{
19651965
#ifndef FRONTEND
1966-
elog(ERROR, "failed to locate backup block with ID %d in WAL record",
1966+
elog(ERROR, "could not locate backup block with ID %d in WAL record",
19671967
block_id);
19681968
#else
1969-
pg_fatal("failed to locate backup block with ID %d in WAL record",
1969+
pg_fatal("could not locate backup block with ID %d in WAL record",
19701970
block_id);
19711971
#endif
19721972
}

src/backend/backup/basebackup.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ parse_basebackup_options(List *options, basebackup_options *opt)
863863
if (!parse_compress_algorithm(optval, &opt->compression))
864864
ereport(ERROR,
865865
(errcode(ERRCODE_SYNTAX_ERROR),
866-
errmsg("unrecognized compression algorithm \"%s\"",
866+
errmsg("unrecognized compression algorithm: \"%s\"",
867867
optval)));
868868
o_compression = true;
869869
}
@@ -919,7 +919,7 @@ parse_basebackup_options(List *options, basebackup_options *opt)
919919
if (o_compression_detail && !o_compression)
920920
ereport(ERROR,
921921
(errcode(ERRCODE_SYNTAX_ERROR),
922-
errmsg("compression detail requires compression")));
922+
errmsg("compression detail cannot be specified unless compression is enabled")));
923923

924924
if (o_compression)
925925
{

src/backend/backup/basebackup_server.c

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

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt)
992992
else
993993
ereport(ERROR,
994994
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
995-
errmsg("invalid create database strategy %s", strategy),
995+
errmsg("invalid create database strategy \"%s\"", strategy),
996996
errhint("Valid strategies are \"wal_log\", and \"file_copy\".")));
997997
}
998998

src/backend/commands/publicationcmds.c

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,8 @@ check_publications(WalReceiverConn *wrconn, List *publications)
461461

462462
if (res->status != WALRCV_OK_TUPLES)
463463
ereport(ERROR,
464-
errmsg_plural("could not receive publication from the publisher: %s",
465-
"could not receive list of publications from the publisher: %s",
466-
list_length(publications),
467-
res->err));
464+
errmsg("could not receive list of publications from the publisher: %s",
465+
res->err));
468466

469467
publicationsCopy = list_copy(publications);
470468

src/backend/commands/trigger.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ renametrig(RenameStmt *stmt)
15321532
ereport(ERROR,
15331533
errmsg("cannot rename trigger \"%s\" on table \"%s\"",
15341534
stmt->subname, RelationGetRelationName(targetrel)),
1535-
errhint("Rename trigger on partitioned table \"%s\" instead.",
1535+
errhint("Rename the trigger on the partitioned table \"%s\" instead.",
15361536
get_rel_name(get_partition_parent(relid, false))));
15371537

15381538

src/backend/executor/nodeModifyTable.c

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ LoadArchiveLibrary(void)
851851

852852
if (archive_init == NULL)
853853
ereport(ERROR,
854-
(errmsg("archive modules have to declare the _PG_archive_module_init symbol")));
854+
(errmsg("archive modules have to define the symbol %s", "_PG_archive_module_init")));
855855

856856
(*archive_init) (&ArchiveContext);
857857

src/backend/replication/logical/tablesync.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1361,7 +1361,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
13611361
if (check_enable_rls(RelationGetRelid(rel), InvalidOid, false) == RLS_ENABLED)
13621362
ereport(ERROR,
13631363
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1364-
errmsg("\"%s\" cannot replicate into relation with row-level security enabled: \"%s\"",
1364+
errmsg("user \"%s\" cannot replicate into relation with row-level security enabled: \"%s\"",
13651365
GetUserNameFromId(GetUserId(), true),
13661366
RelationGetRelationName(rel))));
13671367

src/backend/replication/logical/worker.c

+9-9
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,7 @@ TargetPrivilegesCheck(Relation rel, AclMode mode)
16321632
if (check_enable_rls(relid, InvalidOid, false) == RLS_ENABLED)
16331633
ereport(ERROR,
16341634
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
1635-
errmsg("\"%s\" cannot replicate into relation with row-level security enabled: \"%s\"",
1635+
errmsg("user \"%s\" cannot replicate into relation with row-level security enabled: \"%s\"",
16361636
GetUserNameFromId(GetUserId(), true),
16371637
RelationGetRelationName(rel))));
16381638
}
@@ -3791,7 +3791,7 @@ ApplyWorkerMain(Datum main_arg)
37913791
}
37923792

37933793
ereport(DEBUG1,
3794-
(errmsg("logical replication apply worker for subscription \"%s\" two_phase is %s",
3794+
(errmsg_internal("logical replication apply worker for subscription \"%s\" two_phase is %s",
37953795
MySubscription->name,
37963796
MySubscription->twophasestate == LOGICALREP_TWOPHASE_STATE_DISABLED ? "DISABLED" :
37973797
MySubscription->twophasestate == LOGICALREP_TWOPHASE_STATE_PENDING ? "PENDING" :
@@ -3840,7 +3840,7 @@ DisableSubscriptionAndExit(void)
38403840

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

38463846
proc_exit(0);
@@ -3975,7 +3975,7 @@ clear_subscription_skip_lsn(XLogRecPtr finish_lsn)
39753975

39763976
if (myskiplsn != finish_lsn)
39773977
ereport(WARNING,
3978-
errmsg("skip-LSN of logical replication subscription \"%s\" cleared", MySubscription->name),
3978+
errmsg("skip-LSN of subscription \"%s\" cleared", MySubscription->name),
39793979
errdetail("Remote transaction's finish WAL location (LSN) %X/%X did not match skip-LSN %X/%X.",
39803980
LSN_FORMAT_ARGS(finish_lsn),
39813981
LSN_FORMAT_ARGS(myskiplsn)));
@@ -4002,31 +4002,31 @@ apply_error_callback(void *arg)
40024002
if (errarg->rel == NULL)
40034003
{
40044004
if (!TransactionIdIsValid(errarg->remote_xid))
4005-
errcontext("processing remote data for replication origin \"%s\" during \"%s\"",
4005+
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\"",
40064006
errarg->origin_name,
40074007
logicalrep_message_type(errarg->command));
40084008
else if (XLogRecPtrIsInvalid(errarg->finish_lsn))
4009-
errcontext("processing remote data for replication origin \"%s\" during \"%s\" in transaction %u",
4009+
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u",
40104010
errarg->origin_name,
40114011
logicalrep_message_type(errarg->command),
40124012
errarg->remote_xid);
40134013
else
4014-
errcontext("processing remote data for replication origin \"%s\" during \"%s\" in transaction %u finished at %X/%X",
4014+
errcontext("processing remote data for replication origin \"%s\" during message type \"%s\" in transaction %u, finished at %X/%X",
40154015
errarg->origin_name,
40164016
logicalrep_message_type(errarg->command),
40174017
errarg->remote_xid,
40184018
LSN_FORMAT_ARGS(errarg->finish_lsn));
40194019
}
40204020
else if (errarg->remote_attnum < 0)
4021-
errcontext("processing remote data for replication origin \"%s\" during \"%s\" for replication target relation \"%s.%s\" in transaction %u finished at %X/%X",
4021+
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",
40224022
errarg->origin_name,
40234023
logicalrep_message_type(errarg->command),
40244024
errarg->rel->remoterel.nspname,
40254025
errarg->rel->remoterel.relname,
40264026
errarg->remote_xid,
40274027
LSN_FORMAT_ARGS(errarg->finish_lsn));
40284028
else
4029-
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",
4029+
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",
40304030
errarg->origin_name,
40314031
logicalrep_message_type(errarg->command),
40324032
errarg->rel->remoterel.nspname,

src/backend/replication/walsender.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,8 @@ ReadReplicationSlot(ReadReplicationSlotCmd *cmd)
516516
if (OidIsValid(slot_contents.data.database))
517517
ereport(ERROR,
518518
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
519-
errmsg("cannot use \"%s\" with logical replication slot \"%s\"",
520-
"READ_REPLICATION_SLOT",
521-
NameStr(slot_contents.data.name)));
519+
errmsg("cannot use %s with a logical replication slot",
520+
"READ_REPLICATION_SLOT"));
522521

523522
/* slot type */
524523
values[i] = CStringGetTextDatum("physical");

src/backend/utils/activity/pgstat.c

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

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

+8-7
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,9 @@ CreateBackupStreamer(char *archive_name, char *spclocation,
11081108
*/
11091109
if (inject_manifest && is_compressed_tar)
11101110
{
1111-
pg_log_error("cannot inject manifest into a compressed tarfile");
1112-
pg_log_info("use client-side compression, send the output to a directory rather than standard output, or use --no-manifest");
1111+
pg_log_error("cannot inject manifest into a compressed tar file");
1112+
pg_log_error_hint("Use client-side compression, send the output to a directory rather than standard output, or use %s.",
1113+
"--no-manifest");
11131114
exit(1);
11141115
}
11151116

@@ -1124,7 +1125,7 @@ CreateBackupStreamer(char *archive_name, char *spclocation,
11241125
/* At present, we only know how to parse tar archives. */
11251126
if (must_parse_archive && !is_tar && !is_compressed_tar)
11261127
{
1127-
pg_log_error("unable to parse archive: %s", archive_name);
1128+
pg_log_error("cannot parse archive \"%s\"", archive_name);
11281129
pg_log_error_detail("Only tar archives can be parsed.");
11291130
if (format == 'p')
11301131
pg_log_error_detail("Plain format requires pg_basebackup to parse the archive.");
@@ -1342,7 +1343,7 @@ ReceiveArchiveStreamChunk(size_t r, char *copybuf, void *callback_data)
13421343
/* Sanity check. */
13431344
if (state->manifest_buffer != NULL ||
13441345
state->manifest_file !=NULL)
1345-
pg_fatal("archives should precede manifest");
1346+
pg_fatal("archives must precede manifest");
13461347

13471348
/* Parse the rest of the CopyData message. */
13481349
archive_name = GetCopyDataString(r, copybuf, &cursor);
@@ -1788,7 +1789,7 @@ BaseBackup(char *compression_algorithm, char *compression_detail,
17881789
* Error message already written in CheckServerVersionForStreaming(),
17891790
* but add a hint about using -X none.
17901791
*/
1791-
pg_log_info("HINT: use -X none or -X fetch to disable log streaming");
1792+
pg_log_error_hint("Use -X none or -X fetch to disable log streaming.");
17921793
exit(1);
17931794
}
17941795

@@ -1900,7 +1901,7 @@ BaseBackup(char *compression_algorithm, char *compression_detail,
19001901

19011902
if (showprogress && !verbose)
19021903
{
1903-
fprintf(stderr, "waiting for checkpoint");
1904+
fprintf(stderr, _("waiting for checkpoint"));
19041905
if (isatty(fileno(stderr)))
19051906
fprintf(stderr, "\r");
19061907
else
@@ -2541,7 +2542,7 @@ main(int argc, char **argv)
25412542
char *error_detail;
25422543

25432544
if (!parse_compress_algorithm(compression_algorithm, &alg))
2544-
pg_fatal("unrecognized compression algorithm \"%s\"",
2545+
pg_fatal("unrecognized compression algorithm: \"%s\"",
25452546
compression_algorithm);
25462547

25472548
parse_compress_specification(alg, compression_detail, &client_compress);

src/bin/pg_basebackup/pg_receivewal.c

+3-5
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
}
@@ -863,7 +861,7 @@ main(int argc, char **argv)
863861
*/
864862
if (!parse_compress_algorithm(compression_algorithm_str,
865863
&compression_algorithm))
866-
pg_fatal("unrecognized compression algorithm \"%s\"",
864+
pg_fatal("unrecognized compression algorithm: \"%s\"",
867865
compression_algorithm_str);
868866

869867
parse_compress_specification(compression_algorithm, compression_detail,

src/bin/pg_basebackup/streamutil.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ GetSlotInformation(PGconn *conn, const char *slot_name,
519519
*/
520520
if (PQgetisnull(res, 0, 0))
521521
{
522-
pg_log_error("could not find replication slot \"%s\"", slot_name);
522+
pg_log_error("replication slot \"%s\" does not exist", slot_name);
523523
PQclear(res);
524524
return false;
525525
}

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

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

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

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

+1-1
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)