Skip to content

Commit 50fd428

Browse files
committed
Message style improvements
1 parent bbccf7e commit 50fd428

File tree

19 files changed

+40
-36
lines changed

19 files changed

+40
-36
lines changed

src/backend/access/heap/vacuumlazy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ lazy_scan_heap(LVRelState *vacrel)
14281428
*/
14291429
if (vacrel->eager_scan_max_fails_per_region > 0)
14301430
ereport(vacrel->verbose ? INFO : DEBUG2,
1431-
(errmsg("disabling eager scanning after freezing %u eagerly scanned blocks of \"%s.%s.%s\"",
1431+
(errmsg("disabling eager scanning after freezing %u eagerly scanned blocks of relation \"%s.%s.%s\"",
14321432
orig_eager_scan_success_limit,
14331433
vacrel->dbname, vacrel->relnamespace,
14341434
vacrel->relname)));

src/backend/catalog/heap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3006,7 +3006,7 @@ AddRelationNotNullConstraints(Relation rel, List *constraints,
30063006
if (constr->is_no_inherit)
30073007
ereport(ERROR,
30083008
(errcode(ERRCODE_DATATYPE_MISMATCH),
3009-
errmsg("cannot define not-null constraint on column \"%s\" with NO INHERIT",
3009+
errmsg("cannot define not-null constraint with NO INHERIT on column \"%s\"",
30103010
strVal(linitial(constr->keys))),
30113011
errdetail("The column has an inherited not-null constraint.")));
30123012

src/backend/commands/matview.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,8 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner,
835835
if (!foundUniqueIndex)
836836
ereport(ERROR,
837837
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
838-
errmsg("could not find suitable unique index on materialized view"));
838+
errmsg("could not find suitable unique index on materialized view \"%s\"",
839+
RelationGetRelationName(matviewRel)));
839840

840841
appendStringInfoString(&querybuf,
841842
" AND newdata.* OPERATOR(pg_catalog.*=) mv.*) "

src/backend/commands/publicationcmds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2130,8 +2130,8 @@ defGetGeneratedColsOption(DefElem *def)
21302130

21312131
ereport(ERROR,
21322132
errcode(ERRCODE_SYNTAX_ERROR),
2133-
errmsg("%s requires a \"none\" or \"stored\" value",
2134-
def->defname));
2133+
errmsg("invalid value for publication parameter \"%s\": \"%s\"", def->defname, sval),
2134+
errdetail("Valid values are \"%s\" and \"%s\".", "none", "stored"));
21352135

21362136
return PUBLISH_GENCOLS_NONE; /* keep compiler quiet */
21372137
}

src/backend/commands/subscriptioncmds.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
12671267
IsSet(opts.specified_opts, SUBOPT_SLOT_NAME))
12681268
ereport(ERROR,
12691269
(errcode(ERRCODE_SYNTAX_ERROR),
1270-
errmsg("slot_name and two_phase cannot be altered at the same time")));
1270+
errmsg("\"slot_name\" and \"two_phase\" cannot be altered at the same time")));
12711271

12721272
/*
12731273
* Note that workers may still survive even if the
@@ -1283,7 +1283,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
12831283
if (logicalrep_workers_find(subid, true, true))
12841284
ereport(ERROR,
12851285
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1286-
errmsg("cannot alter two_phase when logical replication worker is still running"),
1286+
errmsg("cannot alter \"two_phase\" when logical replication worker is still running"),
12871287
errhint("Try again after some time.")));
12881288

12891289
/*
@@ -1297,7 +1297,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
12971297
LookupGXactBySubid(subid))
12981298
ereport(ERROR,
12991299
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1300-
errmsg("cannot disable two_phase when prepared transactions are present"),
1300+
errmsg("cannot disable \"two_phase\" when prepared transactions exist"),
13011301
errhint("Resolve these transactions and try again.")));
13021302

13031303
/* Change system catalog accordingly */

src/backend/commands/tablecmds.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8609,7 +8609,7 @@ ATExecSetExpression(AlteredTableInfo *tab, Relation rel, const char *colName,
86098609
rel->rd_att->constr && rel->rd_att->constr->num_check > 0)
86108610
ereport(ERROR,
86118611
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
8612-
errmsg("ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables with check constraints"),
8612+
errmsg("ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables with check constraints"),
86138613
errdetail("Column \"%s\" of relation \"%s\" is a virtual generated column.",
86148614
colName, RelationGetRelationName(rel))));
86158615

@@ -8627,7 +8627,7 @@ ATExecSetExpression(AlteredTableInfo *tab, Relation rel, const char *colName,
86278627
GetRelationPublications(RelationGetRelid(rel)) != NIL)
86288628
ereport(ERROR,
86298629
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
8630-
errmsg("ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables that are part of a publication"),
8630+
errmsg("ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables that are part of a publication"),
86318631
errdetail("Column \"%s\" of relation \"%s\" is a virtual generated column.",
86328632
colName, RelationGetRelationName(rel))));
86338633

@@ -10189,7 +10189,7 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
1018910189
if (pk_has_without_overlaps && !with_period)
1019010190
ereport(ERROR,
1019110191
errcode(ERRCODE_INVALID_FOREIGN_KEY),
10192-
errmsg("foreign key must use PERIOD when referencing a primary using WITHOUT OVERLAPS"));
10192+
errmsg("foreign key must use PERIOD when referencing a primary key using WITHOUT OVERLAPS"));
1019310193

1019410194
/*
1019510195
* Now we can check permissions.
@@ -12913,8 +12913,9 @@ ATExecValidateConstraint(List **wqueue, Relation rel, char *constrName,
1291312913
con->contype != CONSTRAINT_NOTNULL)
1291412914
ereport(ERROR,
1291512915
errcode(ERRCODE_WRONG_OBJECT_TYPE),
12916-
errmsg("constraint \"%s\" of relation \"%s\" is not a foreign key, check, or not-null constraint",
12917-
constrName, RelationGetRelationName(rel)));
12916+
errmsg("cannot validate constraint \"%s\" of relation \"%s\"",
12917+
constrName, RelationGetRelationName(rel)),
12918+
errdetail("This operation is not supported for this type of constraint."));
1291812919

1291912920
if (!con->conenforced)
1292012921
ereport(ERROR,

src/backend/libpq/be-secure-openssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,10 +1436,10 @@ initialize_ecdh(SSL_CTX *context, bool isServerStart)
14361436
*/
14371437
ereport(isServerStart ? FATAL : LOG,
14381438
errcode(ERRCODE_CONFIG_FILE_ERROR),
1439-
errmsg("failed to set group names specified in ssl_groups: %s",
1439+
errmsg("could not set group names specified in ssl_groups: %s",
14401440
SSLerrmessageExt(ERR_get_error(),
14411441
_("No valid groups found"))),
1442-
errhint("Ensure that each group name is spelled correctly and supported by the installed version of OpenSSL"));
1442+
errhint("Ensure that each group name is spelled correctly and supported by the installed version of OpenSSL."));
14431443
return false;
14441444
}
14451445
#endif

src/backend/replication/logical/launcher.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ logicalrep_worker_launch(LogicalRepWorkerType wtype,
341341
if (max_active_replication_origins == 0)
342342
ereport(ERROR,
343343
(errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
344-
errmsg("cannot start logical replication workers when \"max_active_replication_origins\"=0")));
344+
errmsg("cannot start logical replication workers when \"max_active_replication_origins\" is 0")));
345345

346346
/*
347347
* We need to do the modification of the shared memory under lock so that

src/backend/replication/logical/slotsync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ update_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid,
213213
ereport(slot->data.persistency == RS_TEMPORARY ? LOG : DEBUG1,
214214
errmsg("could not synchronize replication slot \"%s\"",
215215
remote_slot->name),
216-
errdetail("Synchronization could lead to data loss as the remote slot needs WAL at LSN %X/%X and catalog xmin %u, but the standby has LSN %X/%X and catalog xmin %u.",
216+
errdetail("Synchronization could lead to data loss, because the remote slot needs WAL at LSN %X/%X and catalog xmin %u, but the standby has LSN %X/%X and catalog xmin %u.",
217217
LSN_FORMAT_ARGS(remote_slot->restart_lsn),
218218
remote_slot->catalog_xmin,
219219
LSN_FORMAT_ARGS(slot->data.restart_lsn),
@@ -593,7 +593,7 @@ update_and_persist_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid)
593593
{
594594
ereport(LOG,
595595
errmsg("could not synchronize replication slot \"%s\"", remote_slot->name),
596-
errdetail("Synchronization could lead to data loss as standby could not build a consistent snapshot to decode WALs at LSN %X/%X.",
596+
errdetail("Synchronization could lead to data loss, because the standby could not build a consistent snapshot to decode WALs at LSN %X/%X.",
597597
LSN_FORMAT_ARGS(slot->data.restart_lsn)));
598598

599599
return false;

src/backend/replication/pgoutput/pgoutput.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1789,7 +1789,7 @@ LoadPublications(List *pubnames)
17891789
else
17901790
ereport(WARNING,
17911791
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1792-
errmsg("skipped loading publication: %s", pubname),
1792+
errmsg("skipped loading publication \"%s\"", pubname),
17931793
errdetail("The publication does not exist at this point in the WAL."),
17941794
errhint("Create the publication if it does not exist."));
17951795
}

src/backend/tcop/backend_startup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -881,15 +881,15 @@ ProcessCancelRequestPacket(Port *port, void *pkt, int pktlen)
881881
{
882882
ereport(COMMERROR,
883883
(errcode(ERRCODE_PROTOCOL_VIOLATION),
884-
errmsg("invalid length of query cancel packet")));
884+
errmsg("invalid length of cancel request packet")));
885885
return;
886886
}
887887
len = pktlen - offsetof(CancelRequestPacket, cancelAuthCode);
888888
if (len == 0 || len > 256)
889889
{
890890
ereport(COMMERROR,
891891
(errcode(ERRCODE_PROTOCOL_VIOLATION),
892-
errmsg("invalid length of query cancel key")));
892+
errmsg("invalid length of cancel key in cancel request packet")));
893893
return;
894894
}
895895

@@ -1077,7 +1077,7 @@ check_log_connections(char **newval, void **extra, GucSource source)
10771077

10781078
if (!SplitIdentifierString(rawstring, ',', &elemlist))
10791079
{
1080-
GUC_check_errdetail("Invalid list syntax in parameter \"log_connections\".");
1080+
GUC_check_errdetail("Invalid list syntax in parameter \"%s\".", "log_connections");
10811081
pfree(rawstring);
10821082
list_free(elemlist);
10831083
return false;

src/backend/utils/adt/formatting.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,14 +3590,15 @@ DCH_from_char(FormatNode *node, const char *in, TmFromChar *out,
35903590
if (matched < 2)
35913591
ereturn(escontext,,
35923592
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
3593-
errmsg("invalid input string for \"Y,YYY\"")));
3593+
errmsg("invalid value \"%s\" for \"%s\"",
3594+
s, "Y,YYY")));
35943595

35953596
/* years += (millennia * 1000); */
35963597
if (pg_mul_s32_overflow(millennia, 1000, &millennia) ||
35973598
pg_add_s32_overflow(years, millennia, &years))
35983599
ereturn(escontext,,
35993600
(errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
3600-
errmsg("value for \"Y,YYY\" in source string is out of range")));
3601+
errmsg("value for \"%s\" in source string is out of range", "Y,YYY")));
36013602

36023603
if (!from_char_set_int(&out->year, years, n, escontext))
36033604
return;

src/backend/utils/misc/guc_tables.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ struct config_bool ConfigureNamesBool[] =
10281028
},
10291029
{
10301030
{"enable_distinct_reordering", PGC_USERSET, QUERY_TUNING_METHOD,
1031-
gettext_noop("Enables reordering of DISTINCT pathkeys."),
1031+
gettext_noop("Enables reordering of DISTINCT keys."),
10321032
NULL,
10331033
GUC_EXPLAIN
10341034
},
@@ -4837,7 +4837,7 @@ struct config_string ConfigureNamesString[] =
48374837
{
48384838
{"ssl_groups", PGC_SIGHUP, CONN_AUTH_SSL,
48394839
gettext_noop("Sets the group(s) to use for Diffie-Hellman key exchange."),
4840-
gettext_noop("Multiple groups can be specified using colon-separated list."),
4840+
gettext_noop("Multiple groups can be specified using a colon-separated list."),
48414841
GUC_SUPERUSER_ONLY
48424842
},
48434843
&SSLECDHCurve,

src/test/regress/expected/generated_virtual.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,10 +634,10 @@ INSERT INTO gtest20 (a) VALUES (30); -- violates constraint
634634
ERROR: new row for relation "gtest20" violates check constraint "gtest20_b_check"
635635
DETAIL: Failing row contains (30, virtual).
636636
ALTER TABLE gtest20 ALTER COLUMN b SET EXPRESSION AS (a * 100); -- violates constraint (currently not supported)
637-
ERROR: ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables with check constraints
637+
ERROR: ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables with check constraints
638638
DETAIL: Column "b" of relation "gtest20" is a virtual generated column.
639639
ALTER TABLE gtest20 ALTER COLUMN b SET EXPRESSION AS (a * 3); -- ok (currently not supported)
640-
ERROR: ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables with check constraints
640+
ERROR: ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables with check constraints
641641
DETAIL: Column "b" of relation "gtest20" is a virtual generated column.
642642
CREATE TABLE gtest20a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) VIRTUAL);
643643
INSERT INTO gtest20a (a) VALUES (10);

src/test/regress/expected/inherit.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2281,7 +2281,7 @@ Inherits: pp1,
22812281
create table cc3 (a2 int not null no inherit) inherits (cc1);
22822282
NOTICE: moving and merging column "a2" with inherited definition
22832283
DETAIL: User-specified column moved to the position of the inherited column.
2284-
ERROR: cannot define not-null constraint on column "a2" with NO INHERIT
2284+
ERROR: cannot define not-null constraint with NO INHERIT on column "a2"
22852285
DETAIL: The column has an inherited not-null constraint.
22862286
-- change NO INHERIT status of inherited constraint: no dice, it's inherited
22872287
alter table cc2 add not null a2 no inherit;
@@ -2530,7 +2530,7 @@ ERROR: conflicting NO INHERIT declaration for not-null constraint on column "a"
25302530
CREATE TABLE inh_nn1 (a int not null);
25312531
CREATE TABLE inh_nn2 (a int not null no inherit) INHERITS (inh_nn1);
25322532
NOTICE: merging column "a" with inherited definition
2533-
ERROR: cannot define not-null constraint on column "a" with NO INHERIT
2533+
ERROR: cannot define not-null constraint with NO INHERIT on column "a"
25342534
DETAIL: The column has an inherited not-null constraint.
25352535
CREATE TABLE inh_nn3 (a int not null, b int, not null a no inherit);
25362536
ERROR: conflicting NO INHERIT declaration for not-null constraint on column "a"

src/test/regress/expected/matview.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ CREATE MATERIALIZED VIEW drop_idx_matview AS
587587
NOTICE: index "mvtest_drop_idx" does not exist, skipping
588588
CREATE UNIQUE INDEX mvtest_drop_idx ON drop_idx_matview (i);
589589
REFRESH MATERIALIZED VIEW CONCURRENTLY drop_idx_matview;
590-
ERROR: could not find suitable unique index on materialized view
590+
ERROR: could not find suitable unique index on materialized view "drop_idx_matview"
591591
DROP MATERIALIZED VIEW drop_idx_matview; -- clean up
592592
RESET search_path;
593593
-- make sure that create WITH NO DATA works via SPI

src/test/regress/expected/publication.out

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ ERROR: conflicting or redundant options
3434
LINE 1: ...pub_xxx WITH (publish_generated_columns = stored, publish_ge...
3535
^
3636
CREATE PUBLICATION testpub_xxx WITH (publish_generated_columns = foo);
37-
ERROR: publish_generated_columns requires a "none" or "stored" value
37+
ERROR: invalid value for publication parameter "publish_generated_columns": "foo"
38+
DETAIL: Valid values are "none" and "stored".
3839
\dRp
3940
List of publications
4041
Name | Owner | All tables | Inserts | Updates | Deletes | Truncates | Generated columns | Via root
@@ -539,7 +540,7 @@ SET client_min_messages = 'ERROR';
539540
CREATE TABLE testpub_rf_tbl7 (id int PRIMARY KEY, x int, y int GENERATED ALWAYS AS (x * 111) VIRTUAL);
540541
CREATE PUBLICATION testpub8 FOR TABLE testpub_rf_tbl7 WHERE (y > 100);
541542
ALTER TABLE testpub_rf_tbl7 ALTER COLUMN y SET EXPRESSION AS (x * testpub_rf_func2());
542-
ERROR: ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables that are part of a publication
543+
ERROR: ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables that are part of a publication
543544
DETAIL: Column "y" of relation "testpub_rf_tbl7" is a virtual generated column.
544545
RESET client_min_messages;
545546
DROP TABLE testpub_rf_tbl1;

src/test/regress/expected/without_overlaps.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,7 @@ CREATE TABLE temporal_fk_rng2rng (
14261426
CONSTRAINT temporal_fk_rng2rng_fk FOREIGN KEY (parent_id, valid_at)
14271427
REFERENCES temporal_rng (id, valid_at)
14281428
);
1429-
ERROR: foreign key must use PERIOD when referencing a primary using WITHOUT OVERLAPS
1429+
ERROR: foreign key must use PERIOD when referencing a primary key using WITHOUT OVERLAPS
14301430
-- (parent_id, valid_at) REFERENCES (id, PERIOD valid_at)
14311431
-- FOREIGN KEY part should specify PERIOD
14321432
CREATE TABLE temporal_fk_rng2rng (
@@ -1900,7 +1900,7 @@ CREATE TABLE temporal_fk_mltrng2mltrng (
19001900
CONSTRAINT temporal_fk_mltrng2mltrng_fk FOREIGN KEY (parent_id, valid_at)
19011901
REFERENCES temporal_mltrng (id, valid_at)
19021902
);
1903-
ERROR: foreign key must use PERIOD when referencing a primary using WITHOUT OVERLAPS
1903+
ERROR: foreign key must use PERIOD when referencing a primary key using WITHOUT OVERLAPS
19041904
-- (parent_id, valid_at) REFERENCES (id, PERIOD valid_at)
19051905
-- FOREIGN KEY part should specify PERIOD
19061906
CREATE TABLE temporal_fk_mltrng2mltrng (

src/test/subscription/t/024_add_drop_pub.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112

113113
# Verify that a warning is logged.
114114
$node_publisher->wait_for_log(
115-
qr/WARNING: ( [A-Z0-9]+:)? skipped loading publication: tap_pub_3/, $offset);
115+
qr/WARNING: ( [A-Z0-9]+:)? skipped loading publication "tap_pub_3"/, $offset);
116116

117117
$node_publisher->safe_psql('postgres',
118118
"CREATE PUBLICATION tap_pub_3 FOR TABLE tab_3");

0 commit comments

Comments
 (0)