]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix style in a few REPACK ereports
authorÁlvaro Herrera <alvherre@kurilemu.de>
Wed, 13 May 2026 16:28:31 +0000 (18:28 +0200)
committerÁlvaro Herrera <alvherre@kurilemu.de>
Wed, 13 May 2026 16:28:31 +0000 (18:28 +0200)
Use consistent "REPACK (CONCURRENTLY)" naming in errhint messages,
matching the actual command syntax and the errmsg text used elsewhere
in the same file.  Also improve the ereport() after XLogReadRecord
failure to be like others in the tree.

While at it, remove direct mentions of the DDL in the translatable
strings, both in the same errhint() calls as well as some errmsg()
calls.  Add periods where missing.

There are all oversights in 28d534e2ae0a.

Reported-by: Baji Shaik <baji.pgdev@gmail.com>
Discussion: https://postgr.es/m/CA+fm-RPxX1xTcYY4qQGPRDXB2-Fy2SDNdZi=zVjr0j=MPg2PaA@mail.gmail.com

src/backend/commands/repack.c
src/backend/commands/repack_worker.c
src/test/regress/expected/cluster.out

index 860e2aecbe9b1c4e8aa80d960f82c1d051e06c4e..fae88d6bb83170fe5726671ffcec23e185d0d5d6 100644 (file)
@@ -328,13 +328,15 @@ ExecRepack(ParseState *pstate, RepackStmt *stmt, bool isTopLevel)
                        Assert(rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
                        ereport(ERROR,
                                        errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                                       errmsg("REPACK (CONCURRENTLY) is not supported for partitioned tables"),
+                                       errmsg("%s is not supported for partitioned tables",
+                                                  "REPACK (CONCURRENTLY)"),
                                        errhint("Consider running the command on individual partitions."));
                }
                else
                        ereport(ERROR,
                                        errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                                       errmsg("REPACK (CONCURRENTLY) requires an explicit table name"));
+                                       errmsg("%s requires an explicit table name",
+                                                  "REPACK (CONCURRENTLY)"));
        }
 
        /*
@@ -893,7 +895,8 @@ check_concurrent_repack_requirements(Relation rel, Oid *ident_idx_p)
                                errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                errmsg("cannot repack relation \"%s\"",
                                           RelationGetRelationName(rel)),
-                               errhint("REPACK CONCURRENTLY is not supported for catalog relations."));
+                               errhint("%s is not supported for catalog relations.",
+                                               "REPACK (CONCURRENTLY)"));
 
        /*
         * reorderbuffer.c does not seem to handle processing of TOAST relation
@@ -904,7 +907,8 @@ check_concurrent_repack_requirements(Relation rel, Oid *ident_idx_p)
                                errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
                                errmsg("cannot repack relation \"%s\"",
                                           RelationGetRelationName(rel)),
-                               errhint("REPACK CONCURRENTLY is not supported for TOAST relations"));
+                               errhint("%s is not supported for TOAST relations.",
+                                               "REPACK (CONCURRENTLY)"));
 
        relpersistence = rel->rd_rel->relpersistence;
        if (relpersistence != RELPERSISTENCE_PERMANENT)
@@ -912,7 +916,8 @@ check_concurrent_repack_requirements(Relation rel, Oid *ident_idx_p)
                                errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
                                errmsg("cannot repack relation \"%s\"",
                                           RelationGetRelationName(rel)),
-                               errhint("REPACK CONCURRENTLY is only allowed for permanent relations."));
+                               errhint("%s is only allowed for permanent relations.",
+                                               "REPACK (CONCURRENTLY)"));
 
        /* With NOTHING, WAL does not contain the old tuple. */
        replident = rel->rd_rel->relreplident;
index c40f8c98e06608ef7f7694080f483db1e7f93077..b84041372b844fa68b20c520b208bc816beca76e 100644 (file)
@@ -415,7 +415,11 @@ decode_concurrent_changes(LogicalDecodingContext *ctx,
 
                        if (errm)
                                ereport(ERROR,
-                                               errmsg("%s", errm));
+                                               errcode_for_file_access(),
+                                               errmsg("could not read WAL from timeline %u at %X/%08X: %s",
+                                                          ctx->reader->currTLI,
+                                                          LSN_FORMAT_ARGS(ctx->reader->EndRecPtr),
+                                                          errm));
 
                        /*
                         * In the decoding loop we do not want to get blocked when there
index 0317f2f801e085ee1ef548ddb56630a8cfb74968..504ac1a3131581d4b9f452a0b2f86137cbbda3b9 100644 (file)
@@ -802,7 +802,7 @@ ORDER BY o.relname;
 -- Disallowed in catalogs
 REPACK (CONCURRENTLY) pg_class;
 ERROR:  cannot repack relation "pg_class"
-HINT:  REPACK CONCURRENTLY is not supported for catalog relations.
+HINT:  REPACK (CONCURRENTLY) is not supported for catalog relations.
 -- Doesn't like partitioned tables
 REPACK (CONCURRENTLY) clstrpart;
 ERROR:  REPACK (CONCURRENTLY) is not supported for partitioned tables
@@ -810,17 +810,17 @@ HINT:  Consider running the command on individual partitions.
 -- Doesn't support catalog tables
 REPACK (CONCURRENTLY) pg_class;
 ERROR:  cannot repack relation "pg_class"
-HINT:  REPACK CONCURRENTLY is not supported for catalog relations.
+HINT:  REPACK (CONCURRENTLY) is not supported for catalog relations.
 -- Only support permanent tables, temp and unlogged tables are not supported
 CREATE TEMP TABLE repack_conc_temp (i int PRIMARY KEY);
 REPACK (CONCURRENTLY) repack_conc_temp;
 ERROR:  cannot repack relation "repack_conc_temp"
-HINT:  REPACK CONCURRENTLY is only allowed for permanent relations.
+HINT:  REPACK (CONCURRENTLY) is only allowed for permanent relations.
 DROP TABLE repack_conc_temp;
 CREATE UNLOGGED TABLE repack_conc_unlogged (i int PRIMARY KEY);
 REPACK (CONCURRENTLY) repack_conc_unlogged;
 ERROR:  cannot repack relation "repack_conc_unlogged"
-HINT:  REPACK CONCURRENTLY is only allowed for permanent relations.
+HINT:  REPACK (CONCURRENTLY) is only allowed for permanent relations.
 DROP TABLE repack_conc_unlogged;
 -- Doesn't support TOAST tables directly
 CREATE TABLE repack_conc_toast (t text);