From 80ba2a135438155182857ee639ea69f1f1ebfbca Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 27 Oct 2025 13:53:00 +1100 Subject: [PATCH v2] fix wal_level equality code --- src/backend/commands/publicationcmds.c | 4 ++-- src/bin/pg_upgrade/check.c | 2 +- src/test/regress/expected/publication.out | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c index 1faf3a8..efe3d13 100644 --- a/src/backend/commands/publicationcmds.c +++ b/src/backend/commands/publicationcmds.c @@ -975,11 +975,11 @@ CreatePublication(ParseState *pstate, CreatePublicationStmt *stmt) InvokeObjectPostCreateHook(PublicationRelationId, puboid, 0); - if (wal_level != WAL_LEVEL_LOGICAL) + if (wal_level < WAL_LEVEL_LOGICAL) ereport(WARNING, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("\"wal_level\" is insufficient to publish logical changes"), - errhint("Set \"wal_level\" to \"logical\" before creating subscriptions."))); + errhint("Set \"wal_level\" >= \"logical\" before creating subscriptions."))); return myself; } diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c index 1e17d64..ddc89ac 100644 --- a/src/bin/pg_upgrade/check.c +++ b/src/bin/pg_upgrade/check.c @@ -2132,7 +2132,7 @@ check_new_cluster_replication_slots(void) wal_level = PQgetvalue(res, 0, 0); if (nslots_on_old > 0 && strcmp(wal_level, "logical") != 0) - pg_fatal("\"wal_level\" must be \"logical\" but is set to \"%s\"", + pg_fatal("\"wal_level\" must be \"logical\" or higher but is set to \"%s\"", wal_level); if (old_cluster.sub_retain_dead_tuples && diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index e72d130..6a40cba 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -289,11 +289,11 @@ SET client_min_messages = 'NOTICE'; CREATE PUBLICATION regress_pub_for_allsequences_alltables_withclause FOR ALL SEQUENCES, ALL TABLES WITH (publish = 'insert'); NOTICE: publication parameters are not applicable to sequence synchronization and will be ignored for sequences WARNING: "wal_level" is insufficient to publish logical changes -HINT: Set "wal_level" to "logical" before creating subscriptions. +HINT: Set "wal_level" >= "logical" before creating subscriptions. CREATE PUBLICATION regress_pub_for_allsequences_withclause FOR ALL SEQUENCES WITH (publish_generated_columns = 'stored'); NOTICE: publication parameters are not applicable to sequence synchronization and will be ignored for sequences WARNING: "wal_level" is insufficient to publish logical changes -HINT: Set "wal_level" to "logical" before creating subscriptions. +HINT: Set "wal_level" >= "logical" before creating subscriptions. RESET client_min_messages; SELECT pubname, puballtables, puballsequences FROM pg_publication WHERE pubname = 'regress_pub_for_allsequences_alltables'; pubname | puballtables | puballsequences -- 1.8.3.1