From: Álvaro Herrera Date: Wed, 13 May 2026 16:28:31 +0000 (+0200) Subject: Fix style in a few REPACK ereports X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bf63730cb041a834c618082ba3d5e8bf96a31a5;p=thirdparty%2Fpostgresql.git Fix style in a few REPACK ereports 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 Discussion: https://postgr.es/m/CA+fm-RPxX1xTcYY4qQGPRDXB2-Fy2SDNdZi=zVjr0j=MPg2PaA@mail.gmail.com --- diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c index 860e2aecbe9..fae88d6bb83 100644 --- a/src/backend/commands/repack.c +++ b/src/backend/commands/repack.c @@ -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; diff --git a/src/backend/commands/repack_worker.c b/src/backend/commands/repack_worker.c index c40f8c98e06..b84041372b8 100644 --- a/src/backend/commands/repack_worker.c +++ b/src/backend/commands/repack_worker.c @@ -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 diff --git a/src/test/regress/expected/cluster.out b/src/test/regress/expected/cluster.out index 0317f2f801e..504ac1a3131 100644 --- a/src/test/regress/expected/cluster.out +++ b/src/test/regress/expected/cluster.out @@ -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);