pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Cc: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Cc: Antonin Houska <ah@cybertec.at>
Cc: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: Pg Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Robert Treat <rob@xzilla.net>
Subject: Re: Adding REPACK [concurrently]
Date: Fri, 1 May 2026 09:30:27 +0200
Message-ID: <afRWQlulXB6R3uNm@alvherre.pgsql> (raw)
In-Reply-To: <OS9PR01MB121498680B79ECB53367E269EF55AA@OS9PR01MB12149.jpnprd01.prod.outlook.com>

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/

Attachments:

  [text/x-diff] 0001-Turn-protective-Assert-into-elog-ERROR.patch (1.2K, ../afRWQlulXB6R3uNm@alvherre.pgsql/2-0001-Turn-protective-Assert-into-elog-ERROR.patch)
  download | inline diff:
From ce73197dd38d42a08db5f48f4db356b198154fd0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Herrera?= <alvherre@kurilemu.de>
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

view thread (415+ messages)  latest in thread

Message-ID: <afRWQlulXB6R3uNm@alvherre.pgsql>
Permalink:  ../afRWQlulXB6R3uNm@alvherre.pgsql/
Also on:    postgresql.org/message-id/afRWQlulXB6R3uNm@alvherre.pgsql

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, kuroda.hayato@fujitsu.com, mihailnikalayeu@gmail.com, ah@cybertec.at, srinath2133@gmail.com, amit.kapila16@gmail.com, boekewurm+postgres@gmail.com, pgsql-hackers@lists.postgresql.org, rob@xzilla.net
  Subject: Re: Adding REPACK [concurrently]
  In-Reply-To: <afRWQlulXB6R3uNm@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox