Hello,

On 2026-Apr-07, Hayato Kuroda (Fujitsu) wrote:

> 01.
> ```
> --- a/src/backend/access/index/genam.c
> +++ b/src/backend/access/index/genam.c
> @@ -394,6 +394,14 @@ systable_beginscan(Relation heapRelation,
>       SysScanDesc sysscan;
>       Relation        irel;
>  
> +     /*
> +      * If this backend promised that it won't access shared catalogs during
> +      * logical decoding, this it the right place to verify.
> +      */
> +     Assert(!HistoricSnapshotActive() ||
> +                accessSharedCatalogsInDecoding ||
> +                !heapRelation->rd_rel->relisshared);
> ```
> 
> Not sure it's OK to use Assert(). elog(ERROR) might be better if we want to 
> really
> avoid the case.

How about the attached?

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
>From ce73197dd38d42a08db5f48f4db356b198154fd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Herrera?= <[email protected]>
Date: Fri, 1 May 2026 09:23:09 +0200
Subject: [PATCH] Turn protective Assert() into elog(ERROR)

---
 src/backend/access/index/genam.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c
index 97d44b84622..7d401e3f137 100644
--- a/src/backend/access/index/genam.c
+++ b/src/backend/access/index/genam.c
@@ -396,11 +396,13 @@ systable_beginscan(Relation heapRelation,
 
 	/*
 	 * If this backend promised that it won't access shared catalogs during
-	 * logical decoding, this it the right place to verify.
+	 * logical decoding, this is the right place to verify.
 	 */
-	Assert(!HistoricSnapshotActive() ||
-		   accessSharedCatalogsInDecoding ||
-		   !heapRelation->rd_rel->relisshared);
+	if (HistoricSnapshotActive() &&
+		!accessSharedCatalogsInDecoding &&
+		heapRelation->rd_rel->relisshared)
+		elog(ERROR,
+			 "cannot access shared catalog with database-specific historic snapshot");
 
 	if (indexOK &&
 		!IgnoreSystemIndexes &&
-- 
2.47.3

Reply via email to