From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Some RELKIND macro refactoring
Date: Tue, 24 Aug 2021 12:01:33 +0200
Message-ID: <1d3a5fbe-f48b-8bea-80da-9a5c4244aef9@enterprisedb.com> (raw)
In-Reply-To: <202108161422.sodbvh3hb7ra@alvherre.pgsql>
References: <202108161422.sodbvh3hb7ra@alvherre.pgsql>
While analyzing this again, I think I found an existing mistake. The
handling of RELKIND_PARTITIONED_INDEX in
RelationGetNumberOfBlocksInFork() seems to be misplaced. See attached
patch.
Attachments:0001-Fix-handling-of-partitioned-index-in-RelationGetNumb.patch (text/plain, 1.4K) download
From 652d10eaf00aafb91c6f60149b04be90a33e5acb Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 24 Aug 2021 11:56:08 +0200
Subject: [PATCH] Fix handling of partitioned index in
RelationGetNumberOfBlocksInFork()
Since a partitioned index doesn't have storage, getting the number of
blocks from it will not give sensible results. Existing callers
already check that they don't call it that way, so there doesn't
appear to be a live problem. But for correctness, handle
RELKIND_PARTITIONED_INDEX together with the other non-storage
relkinds.
---
src/backend/storage/buffer/bufmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.cindex 3b485de067..bc1753ae91 100644--- a/src/backend/storage/buffer/bufmgr.c+++ b/src/backend/storage/buffer/bufmgr.c@@ -2929,7 +2929,6 @@ RelationGetNumberOfBlocksInFork(Relation relation, ForkNumber forkNum)
{
case RELKIND_SEQUENCE:
case RELKIND_INDEX:
- case RELKIND_PARTITIONED_INDEX:
return smgrnblocks(RelationGetSmgr(relation), forkNum);
case RELKIND_RELATION:
@@ -2951,6 +2950,7 @@ RelationGetNumberOfBlocksInFork(Relation relation, ForkNumber forkNum)
case RELKIND_VIEW:
case RELKIND_COMPOSITE_TYPE:
case RELKIND_FOREIGN_TABLE:
+ case RELKIND_PARTITIONED_INDEX:
case RELKIND_PARTITIONED_TABLE:
default:
Assert(false);
--
2.33.0
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@enterprisedb.com, alvherre@alvh.no-ip.org
Subject: Re: Some RELKIND macro refactoring
In-Reply-To: <1d3a5fbe-f48b-8bea-80da-9a5c4244aef9@enterprisedb.com>
References: <202108161422.sodbvh3hb7ra@alvherre.pgsql> <1d3a5fbe-f48b-8bea-80da-9a5c4244aef9@enterprisedb.com>
* 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