v34-0002-transfer-ownership.patch
application/octet-stream
Filename: v34-0002-transfer-ownership.patch
Type: application/octet-stream
Part: 1
From 472e701c3dac8d82c6d697bdd3d0b43c1016e996 Mon Sep 17 00:00:00 2001
From: Dilip Kumar <dilipkumarb@google.com>
Date: Fri, 8 May 2026 15:49:04 +0530
Subject: [PATCH v34 2/5] 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 94edf2a5737..c22af9be3fd 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.53.0