From: Álvaro Herrera Date: Thu, 28 May 2026 13:04:36 +0000 (+0200) Subject: Improve REPACK (CONCURRENTLY) error when wal_level < replica X-Git-Tag: REL_19_BETA1~27 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=43649b6a53e9;p=thirdparty%2Fpostgresql.git Improve REPACK (CONCURRENTLY) error when wal_level < replica The error emitted when REPACK (CONCURRENTLY) is run with too low a wal_level is thrown by CheckSlotRequirements(), which is a bit mysterious when the user doesn't know what's up. Add an upfront check in check_concurrent_repack_requirements() for a more explicit, REPACK- centered report, which is easier to understand -- this also saves starting the worker just to have it die immediately. Author: Baji Shaik Reviewed-by: Chao Li Discussion: https://postgr.es/m/CA+fm-ROdgh0rEVuXoViBk4TVgjodrN=MTR_RYuOuKLZ9voX4YA@mail.gmail.com --- diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c index da9d941f4a1..c5d85eced48 100644 --- a/src/backend/commands/repack.c +++ b/src/backend/commands/repack.c @@ -40,6 +40,7 @@ #include "access/toast_internals.h" #include "access/transam.h" #include "access/xact.h" +#include "access/xlog.h" #include "catalog/catalog.h" #include "catalog/dependency.h" #include "catalog/heap.h" @@ -897,6 +898,14 @@ check_concurrent_repack_requirements(Relation rel, Oid *ident_idx_p) replident; Oid ident_idx; + if (wal_level < WAL_LEVEL_REPLICA) + ereport(ERROR, + errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("cannot execute \"%s\" in this configuration", + "REPACK (CONCURRENTLY)"), + errdetail("%s requires \"wal_level\" to be set to \"replica\" or higher.", + "REPACK (CONCURRENTLY)")); + /* Data changes in system relations are not logically decoded. */ if (IsCatalogRelation(rel)) ereport(ERROR,