From f9e60f948297a75af9bb8cfbdc9b67a3427e3c05 Mon Sep 17 00:00:00 2001 From: Vignesh C Date: Mon, 24 Aug 2026 10:52:05 +0530 Subject: [PATCH v1] Skip relations dropped concurrently in GetSubscriptionRelations() GetSubscriptionRelations() can see a pg_subscription_rel row for a relation whose pg_class row was removed by a concurrent DROP. In this case get_rel_relkind() returns '\0'. Skip such relations instead of asserting or returning them to the caller, since the relation no longer exists and needs no synchronization. --- src/backend/catalog/pg_subscription.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/pg_subscription.c b/src/backend/catalog/pg_subscription.c index f1e8b624d8e..ae97a0a0db6 100644 --- a/src/backend/catalog/pg_subscription.c +++ b/src/backend/catalog/pg_subscription.c @@ -684,8 +684,13 @@ GetSubscriptionRelations(Oid subid, bool tables, bool sequences, subrel = (Form_pg_subscription_rel) GETSTRUCT(tup); - /* Relation is either a sequence or a table */ relkind = get_rel_relkind(subrel->srrelid); + + /* The relation may have been dropped concurrently. */ + if (relkind == '\0') + continue; + + /* Relation is either a sequence or a table */ Assert(relkind == RELKIND_SEQUENCE || relkind == RELKIND_RELATION || relkind == RELKIND_PARTITIONED_TABLE); -- 2.55.0