]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Message style improvements
authorPeter Eisentraut <peter@eisentraut.org>
Sat, 28 Jun 2025 17:18:06 +0000 (19:18 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Sat, 28 Jun 2025 17:18:06 +0000 (19:18 +0200)
19 files changed:
src/backend/access/heap/vacuumlazy.c
src/backend/catalog/heap.c
src/backend/commands/matview.c
src/backend/commands/publicationcmds.c
src/backend/commands/subscriptioncmds.c
src/backend/commands/tablecmds.c
src/backend/libpq/be-secure-openssl.c
src/backend/replication/logical/launcher.c
src/backend/replication/logical/slotsync.c
src/backend/replication/pgoutput/pgoutput.c
src/backend/tcop/backend_startup.c
src/backend/utils/adt/formatting.c
src/backend/utils/misc/guc_tables.c
src/test/regress/expected/generated_virtual.out
src/test/regress/expected/inherit.out
src/test/regress/expected/matview.out
src/test/regress/expected/publication.out
src/test/regress/expected/without_overlaps.out
src/test/subscription/t/024_add_drop_pub.pl

index 8a42e17aec210fcac1a861be007371d719f297a4..4111a8996b5a1ccef9327c2f685ed7c7cd44393e 100644 (file)
@@ -1428,7 +1428,7 @@ lazy_scan_heap(LVRelState *vacrel)
                                         */
                                        if (vacrel->eager_scan_max_fails_per_region > 0)
                                                ereport(vacrel->verbose ? INFO : DEBUG2,
-                                                               (errmsg("disabling eager scanning after freezing %u eagerly scanned blocks of \"%s.%s.%s\"",
+                                                               (errmsg("disabling eager scanning after freezing %u eagerly scanned blocks of relation \"%s.%s.%s\"",
                                                                                orig_eager_scan_success_limit,
                                                                                vacrel->dbname, vacrel->relnamespace,
                                                                                vacrel->relname)));
index 649d3966e8e21df5581b95700e1812a19c380c36..fd6537567ea27a3ac8e179822406e3a9b16fce20 100644 (file)
@@ -3006,7 +3006,7 @@ AddRelationNotNullConstraints(Relation rel, List *constraints,
                                if (constr->is_no_inherit)
                                        ereport(ERROR,
                                                        (errcode(ERRCODE_DATATYPE_MISMATCH),
-                                                        errmsg("cannot define not-null constraint on column \"%s\" with NO INHERIT",
+                                                        errmsg("cannot define not-null constraint with NO INHERIT on column \"%s\"",
                                                                        strVal(linitial(constr->keys))),
                                                         errdetail("The column has an inherited not-null constraint.")));
 
index 27c2cb26ef5f3903da346308fad756c97ff413be..188e26f0e6e29d9f44f15e2423543b13cb51d203 100644 (file)
@@ -835,7 +835,8 @@ refresh_by_match_merge(Oid matviewOid, Oid tempOid, Oid relowner,
        if (!foundUniqueIndex)
                ereport(ERROR,
                                errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                               errmsg("could not find suitable unique index on materialized view"));
+                               errmsg("could not find suitable unique index on materialized view \"%s\"",
+                                          RelationGetRelationName(matviewRel)));
 
        appendStringInfoString(&querybuf,
                                                   " AND newdata.* OPERATOR(pg_catalog.*=) mv.*) "
index 0b23d94c38e20d6b03282a3da66fe696e03be7b7..1bf7eaae5b362bd85715b4ded64a17dec129f0bb 100644 (file)
@@ -2130,8 +2130,8 @@ defGetGeneratedColsOption(DefElem *def)
 
        ereport(ERROR,
                        errcode(ERRCODE_SYNTAX_ERROR),
-                       errmsg("%s requires a \"none\" or \"stored\" value",
-                                  def->defname));
+                       errmsg("invalid value for publication parameter \"%s\": \"%s\"", def->defname, sval),
+                       errdetail("Valid values are \"%s\" and \"%s\".", "none", "stored"));
 
        return PUBLISH_GENCOLS_NONE;    /* keep compiler quiet */
 }
index 4aec73bcc6bbcf87509d525f0f85c3447315e05e..4ff246cd94321ee426c00c6d5ef98673e39b201d 100644 (file)
@@ -1267,7 +1267,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
                                                IsSet(opts.specified_opts, SUBOPT_SLOT_NAME))
                                                ereport(ERROR,
                                                                (errcode(ERRCODE_SYNTAX_ERROR),
-                                                                errmsg("slot_name and two_phase cannot be altered at the same time")));
+                                                                errmsg("\"slot_name\" and \"two_phase\" cannot be altered at the same time")));
 
                                        /*
                                         * Note that workers may still survive even if the
@@ -1283,7 +1283,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
                                        if (logicalrep_workers_find(subid, true, true))
                                                ereport(ERROR,
                                                                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-                                                                errmsg("cannot alter two_phase when logical replication worker is still running"),
+                                                                errmsg("cannot alter \"two_phase\" when logical replication worker is still running"),
                                                                 errhint("Try again after some time.")));
 
                                        /*
@@ -1297,7 +1297,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
                                                LookupGXactBySubid(subid))
                                                ereport(ERROR,
                                                                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-                                                                errmsg("cannot disable two_phase when prepared transactions are present"),
+                                                                errmsg("cannot disable \"two_phase\" when prepared transactions exist"),
                                                                 errhint("Resolve these transactions and try again.")));
 
                                        /* Change system catalog accordingly */
index e2b94c8c6098b7c78d3cc306265112953ee00213..991bc946ffc446b956b2f9edc42604cbad7eb8fe 100644 (file)
@@ -8609,7 +8609,7 @@ ATExecSetExpression(AlteredTableInfo *tab, Relation rel, const char *colName,
                rel->rd_att->constr && rel->rd_att->constr->num_check > 0)
                ereport(ERROR,
                                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                                errmsg("ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables with check constraints"),
+                                errmsg("ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables with check constraints"),
                                 errdetail("Column \"%s\" of relation \"%s\" is a virtual generated column.",
                                                   colName, RelationGetRelationName(rel))));
 
@@ -8627,7 +8627,7 @@ ATExecSetExpression(AlteredTableInfo *tab, Relation rel, const char *colName,
                GetRelationPublications(RelationGetRelid(rel)) != NIL)
                ereport(ERROR,
                                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                                errmsg("ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables that are part of a publication"),
+                                errmsg("ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables that are part of a publication"),
                                 errdetail("Column \"%s\" of relation \"%s\" is a virtual generated column.",
                                                   colName, RelationGetRelationName(rel))));
 
@@ -10189,7 +10189,7 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
        if (pk_has_without_overlaps && !with_period)
                ereport(ERROR,
                                errcode(ERRCODE_INVALID_FOREIGN_KEY),
-                               errmsg("foreign key must use PERIOD when referencing a primary using WITHOUT OVERLAPS"));
+                               errmsg("foreign key must use PERIOD when referencing a primary key using WITHOUT OVERLAPS"));
 
        /*
         * Now we can check permissions.
@@ -12913,8 +12913,9 @@ ATExecValidateConstraint(List **wqueue, Relation rel, char *constrName,
                con->contype != CONSTRAINT_NOTNULL)
                ereport(ERROR,
                                errcode(ERRCODE_WRONG_OBJECT_TYPE),
-                               errmsg("constraint \"%s\" of relation \"%s\" is not a foreign key, check, or not-null constraint",
-                                          constrName, RelationGetRelationName(rel)));
+                               errmsg("cannot validate constraint \"%s\" of relation \"%s\"",
+                                          constrName, RelationGetRelationName(rel)),
+                               errdetail("This operation is not supported for this type of constraint."));
 
        if (!con->conenforced)
                ereport(ERROR,
index 64ff3ce3d6a7a1d1f06d352440b3162c68fde6b1..c8b63ef8249007a56c9db60cf7ff09dad31c893e 100644 (file)
@@ -1436,10 +1436,10 @@ initialize_ecdh(SSL_CTX *context, bool isServerStart)
                 */
                ereport(isServerStart ? FATAL : LOG,
                                errcode(ERRCODE_CONFIG_FILE_ERROR),
-                               errmsg("failed to set group names specified in ssl_groups: %s",
+                               errmsg("could not set group names specified in ssl_groups: %s",
                                           SSLerrmessageExt(ERR_get_error(),
                                                                                _("No valid groups found"))),
-                               errhint("Ensure that each group name is spelled correctly and supported by the installed version of OpenSSL"));
+                               errhint("Ensure that each group name is spelled correctly and supported by the installed version of OpenSSL."));
                return false;
        }
 #endif
index 14d8efbd25bf5317338a12a8c86978f7810ead9c..4aed0dfcebb24a1668fffb127e0c6b6152c011ec 100644 (file)
@@ -341,7 +341,7 @@ logicalrep_worker_launch(LogicalRepWorkerType wtype,
        if (max_active_replication_origins == 0)
                ereport(ERROR,
                                (errcode(ERRCODE_CONFIGURATION_LIMIT_EXCEEDED),
-                                errmsg("cannot start logical replication workers when \"max_active_replication_origins\"=0")));
+                                errmsg("cannot start logical replication workers when \"max_active_replication_origins\" is 0")));
 
        /*
         * We need to do the modification of the shared memory under lock so that
index f1dcbebfa1ae7f6f07645feb86db735f63cb0c3d..3ec3abfa3da601815e897bef395778f3ae72abf8 100644 (file)
@@ -213,7 +213,7 @@ update_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid,
                ereport(slot->data.persistency == RS_TEMPORARY ? LOG : DEBUG1,
                                errmsg("could not synchronize replication slot \"%s\"",
                                           remote_slot->name),
-                               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.",
+                               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.",
                                                  LSN_FORMAT_ARGS(remote_slot->restart_lsn),
                                                  remote_slot->catalog_xmin,
                                                  LSN_FORMAT_ARGS(slot->data.restart_lsn),
@@ -593,7 +593,7 @@ update_and_persist_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid)
        {
                ereport(LOG,
                                errmsg("could not synchronize replication slot \"%s\"", remote_slot->name),
-                               errdetail("Synchronization could lead to data loss as standby could not build a consistent snapshot to decode WALs at LSN %X/%X.",
+                               errdetail("Synchronization could lead to data loss, because the standby could not build a consistent snapshot to decode WALs at LSN %X/%X.",
                                                  LSN_FORMAT_ARGS(slot->data.restart_lsn)));
 
                return false;
index 693a766e6d75fc5709d95bc0c1ba729f5332b0fb..082b4d9d32798a987d6a14c7a12af642b59aea74 100644 (file)
@@ -1789,7 +1789,7 @@ LoadPublications(List *pubnames)
                else
                        ereport(WARNING,
                                        errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
-                                       errmsg("skipped loading publication: %s", pubname),
+                                       errmsg("skipped loading publication \"%s\"", pubname),
                                        errdetail("The publication does not exist at this point in the WAL."),
                                        errhint("Create the publication if it does not exist."));
        }
index a7d1fec981f881aa879e87827e1bfe247c6f1cec..ad0af5edc1f2183a9e29d2b43b8e0fec1f243a4c 100644 (file)
@@ -881,7 +881,7 @@ ProcessCancelRequestPacket(Port *port, void *pkt, int pktlen)
        {
                ereport(COMMERROR,
                                (errcode(ERRCODE_PROTOCOL_VIOLATION),
-                                errmsg("invalid length of query cancel packet")));
+                                errmsg("invalid length of cancel request packet")));
                return;
        }
        len = pktlen - offsetof(CancelRequestPacket, cancelAuthCode);
@@ -889,7 +889,7 @@ ProcessCancelRequestPacket(Port *port, void *pkt, int pktlen)
        {
                ereport(COMMERROR,
                                (errcode(ERRCODE_PROTOCOL_VIOLATION),
-                                errmsg("invalid length of query cancel key")));
+                                errmsg("invalid length of cancel key in cancel request packet")));
                return;
        }
 
@@ -1077,7 +1077,7 @@ check_log_connections(char **newval, void **extra, GucSource source)
 
        if (!SplitIdentifierString(rawstring, ',', &elemlist))
        {
-               GUC_check_errdetail("Invalid list syntax in parameter \"log_connections\".");
+               GUC_check_errdetail("Invalid list syntax in parameter \"%s\".", "log_connections");
                pfree(rawstring);
                list_free(elemlist);
                return false;
index 5bd1e01f7e4635774de1586521b14f77e823c462..1d05481181db7d94eeb62e4e7f829c86bd914ce2 100644 (file)
@@ -3590,14 +3590,15 @@ DCH_from_char(FormatNode *node, const char *in, TmFromChar *out,
                                        if (matched < 2)
                                                ereturn(escontext,,
                                                                (errcode(ERRCODE_INVALID_DATETIME_FORMAT),
-                                                                errmsg("invalid input string for \"Y,YYY\"")));
+                                                                errmsg("invalid value \"%s\" for \"%s\"",
+                                                                               s, "Y,YYY")));
 
                                        /* years += (millennia * 1000); */
                                        if (pg_mul_s32_overflow(millennia, 1000, &millennia) ||
                                                pg_add_s32_overflow(years, millennia, &years))
                                                ereturn(escontext,,
                                                                (errcode(ERRCODE_DATETIME_FIELD_OVERFLOW),
-                                                                errmsg("value for \"Y,YYY\" in source string is out of range")));
+                                                                errmsg("value for \"%s\" in source string is out of range", "Y,YYY")));
 
                                        if (!from_char_set_int(&out->year, years, n, escontext))
                                                return;
index f04bfedb2fd1036caec085be6b0087c01b7c9d4e..511dc32d519216448a90c6e2798db98c17c40100 100644 (file)
@@ -1028,7 +1028,7 @@ struct config_bool ConfigureNamesBool[] =
        },
        {
                {"enable_distinct_reordering", PGC_USERSET, QUERY_TUNING_METHOD,
-                       gettext_noop("Enables reordering of DISTINCT pathkeys."),
+                       gettext_noop("Enables reordering of DISTINCT keys."),
                        NULL,
                        GUC_EXPLAIN
                },
@@ -4837,7 +4837,7 @@ struct config_string ConfigureNamesString[] =
        {
                {"ssl_groups", PGC_SIGHUP, CONN_AUTH_SSL,
                        gettext_noop("Sets the group(s) to use for Diffie-Hellman key exchange."),
-                       gettext_noop("Multiple groups can be specified using colon-separated list."),
+                       gettext_noop("Multiple groups can be specified using colon-separated list."),
                        GUC_SUPERUSER_ONLY
                },
                &SSLECDHCurve,
index 46713f06797e51d1ee35ed816a717e792b9efddd..df704b5166fa32476446ac4fa4b26afa5aad3bd7 100644 (file)
@@ -634,10 +634,10 @@ INSERT INTO gtest20 (a) VALUES (30);  -- violates constraint
 ERROR:  new row for relation "gtest20" violates check constraint "gtest20_b_check"
 DETAIL:  Failing row contains (30, virtual).
 ALTER TABLE gtest20 ALTER COLUMN b SET EXPRESSION AS (a * 100);  -- violates constraint (currently not supported)
-ERROR:  ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables with check constraints
+ERROR:  ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables with check constraints
 DETAIL:  Column "b" of relation "gtest20" is a virtual generated column.
 ALTER TABLE gtest20 ALTER COLUMN b SET EXPRESSION AS (a * 3);  -- ok (currently not supported)
-ERROR:  ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables with check constraints
+ERROR:  ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables with check constraints
 DETAIL:  Column "b" of relation "gtest20" is a virtual generated column.
 CREATE TABLE gtest20a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) VIRTUAL);
 INSERT INTO gtest20a (a) VALUES (10);
index f9b0c415cfdcc68b49ab89affffad8ec329db05b..78dead65325e9812f1c9a8bac0ddd7be7d4242c4 100644 (file)
@@ -2281,7 +2281,7 @@ Inherits: pp1,
 create table cc3 (a2 int not null no inherit) inherits (cc1);
 NOTICE:  moving and merging column "a2" with inherited definition
 DETAIL:  User-specified column moved to the position of the inherited column.
-ERROR:  cannot define not-null constraint on column "a2" with NO INHERIT
+ERROR:  cannot define not-null constraint with NO INHERIT on column "a2"
 DETAIL:  The column has an inherited not-null constraint.
 -- change NO INHERIT status of inherited constraint: no dice, it's inherited
 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"
 CREATE TABLE inh_nn1 (a int not null);
 CREATE TABLE inh_nn2 (a int not null no inherit) INHERITS (inh_nn1);
 NOTICE:  merging column "a" with inherited definition
-ERROR:  cannot define not-null constraint on column "a" with NO INHERIT
+ERROR:  cannot define not-null constraint with NO INHERIT on column "a"
 DETAIL:  The column has an inherited not-null constraint.
 CREATE TABLE inh_nn3 (a int not null, b int,  not null a no inherit);
 ERROR:  conflicting NO INHERIT declaration for not-null constraint on column "a"
index 54939ecc6b08af146966eb8d7eb10d6f2f5be7e5..c56c9fa3a254494f180f68536ecf3ac798a4f755 100644 (file)
@@ -587,7 +587,7 @@ CREATE MATERIALIZED VIEW drop_idx_matview AS
 NOTICE:  index "mvtest_drop_idx" does not exist, skipping
 CREATE UNIQUE INDEX mvtest_drop_idx ON drop_idx_matview (i);
 REFRESH MATERIALIZED VIEW CONCURRENTLY drop_idx_matview;
-ERROR:  could not find suitable unique index on materialized view
+ERROR:  could not find suitable unique index on materialized view "drop_idx_matview"
 DROP MATERIALIZED VIEW drop_idx_matview; -- clean up
 RESET search_path;
 -- make sure that create WITH NO DATA works via SPI
index f1025fc0f198d5884f1b422e94a999da2ad44a4e..3a2eacd793f70c8ae4b78bf820f14b77775b6748 100644 (file)
@@ -34,7 +34,8 @@ ERROR:  conflicting or redundant options
 LINE 1: ...pub_xxx WITH (publish_generated_columns = stored, publish_ge...
                                                              ^
 CREATE PUBLICATION testpub_xxx WITH (publish_generated_columns = foo);
-ERROR:  publish_generated_columns requires a "none" or "stored" value
+ERROR:  invalid value for publication parameter "publish_generated_columns": "foo"
+DETAIL:  Valid values are "none" and "stored".
 \dRp
                                                         List of publications
         Name        |          Owner           | All tables | Inserts | Updates | Deletes | Truncates | Generated columns | Via root 
@@ -539,7 +540,7 @@ SET client_min_messages = 'ERROR';
 CREATE TABLE testpub_rf_tbl7 (id int PRIMARY KEY, x int, y int GENERATED ALWAYS AS (x * 111) VIRTUAL);
 CREATE PUBLICATION testpub8 FOR TABLE testpub_rf_tbl7 WHERE (y > 100);
 ALTER TABLE testpub_rf_tbl7 ALTER COLUMN y SET EXPRESSION AS (x * testpub_rf_func2());
-ERROR:  ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns on tables that are part of a publication
+ERROR:  ALTER TABLE / SET EXPRESSION is not supported for virtual generated columns in tables that are part of a publication
 DETAIL:  Column "y" of relation "testpub_rf_tbl7" is a virtual generated column.
 RESET client_min_messages;
 DROP TABLE testpub_rf_tbl1;
index ea607bed0a412ff7b9e945a274ce8c26f333aad8..f3144bdc39c2141f691b925bc2a6c6ee9a98feb6 100644 (file)
@@ -1426,7 +1426,7 @@ CREATE TABLE temporal_fk_rng2rng (
   CONSTRAINT temporal_fk_rng2rng_fk FOREIGN KEY (parent_id, valid_at)
     REFERENCES temporal_rng (id, valid_at)
 );
-ERROR:  foreign key must use PERIOD when referencing a primary using WITHOUT OVERLAPS
+ERROR:  foreign key must use PERIOD when referencing a primary key using WITHOUT OVERLAPS
 -- (parent_id, valid_at) REFERENCES (id, PERIOD valid_at)
 -- FOREIGN KEY part should specify PERIOD
 CREATE TABLE temporal_fk_rng2rng (
@@ -1900,7 +1900,7 @@ CREATE TABLE temporal_fk_mltrng2mltrng (
   CONSTRAINT temporal_fk_mltrng2mltrng_fk FOREIGN KEY (parent_id, valid_at)
     REFERENCES temporal_mltrng (id, valid_at)
 );
-ERROR:  foreign key must use PERIOD when referencing a primary using WITHOUT OVERLAPS
+ERROR:  foreign key must use PERIOD when referencing a primary key using WITHOUT OVERLAPS
 -- (parent_id, valid_at) REFERENCES (id, PERIOD valid_at)
 -- FOREIGN KEY part should specify PERIOD
 CREATE TABLE temporal_fk_mltrng2mltrng (
index e995d8b3839016695d25db63f393b92b7cae9139..5298d43197900532014ac781bffe204a5760ace7 100644 (file)
@@ -112,7 +112,7 @@ $node_publisher->safe_psql('postgres',"INSERT INTO tab_3 values(1)");
 
 # Verify that a warning is logged.
 $node_publisher->wait_for_log(
-       qr/WARNING: ( [A-Z0-9]+:)? skipped loading publication: tap_pub_3/, $offset);
+       qr/WARNING: ( [A-Z0-9]+:)? skipped loading publication "tap_pub_3"/, $offset);
 
 $node_publisher->safe_psql('postgres',
        "CREATE PUBLICATION tap_pub_3 FOR TABLE tab_3");