From 208be7f532e3b6bda6807aebc17cbe01caf394c4 Mon Sep 17 00:00:00 2001 From: Dilip Kumar Date: Fri, 8 May 2026 15:49:04 +0530 Subject: [PATCH v32 2/4] transfer ownership --- src/backend/commands/subscriptioncmds.c | 6 ++++++ src/bin/initdb/initdb.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index 51b7308ed08..2e7c326ecd5 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -38,6 +38,7 @@ #include "commands/defrem.h" #include "commands/event_trigger.h" #include "commands/subscriptioncmds.h" +#include "commands/tablecmds.h" #include "executor/executor.h" #include "foreign/foreign.h" #include "miscadmin.h" @@ -2719,6 +2720,11 @@ AlterSubscriptionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId) form->subowner = newOwnerId; CatalogTupleUpdate(rel, &tup->t_self, tup); + /* Update owner of the conflict log table if it exists. */ + if (OidIsValid(form->subconflictlogrelid)) + ATExecChangeOwner(form->subconflictlogrelid, newOwnerId, true, + AccessExclusiveLock); + /* Update owner dependency reference */ changeDependencyOnOwner(SubscriptionRelationId, form->oid, diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index fa3316fcb97..cda05676a79 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1839,7 +1839,7 @@ setup_privileges(FILE *cmdfd) " AND relacl IS NULL;\n\n", escape_quotes(username)); PG_CMD_PUTS("GRANT USAGE ON SCHEMA pg_catalog, public TO PUBLIC;\n\n"); - PG_CMD_PUTS("GRANT USAGE ON SCHEMA pg_conflict TO pg_create_subscription;\n\n"); + PG_CMD_PUTS("GRANT USAGE ON SCHEMA pg_conflict TO PUBLIC;\n\n"); PG_CMD_PUTS("REVOKE ALL ON pg_largeobject FROM PUBLIC;\n\n"); PG_CMD_PUTS("INSERT INTO pg_init_privs " " (objoid, classoid, objsubid, initprivs, privtype)" -- 2.49.0