Wrong datatype used in visibilitymap_get_status
Hi,
I was reading the visibility map code and noticed that
visibilitymap_get_status() wasn't updated in a892234f830e AFAICS (Cc Robert and
Sawada-san) to return an empty set of flags rather than false in one code path,
so simple patch attached. Both have the same value so that likely explains why
it got unnoticed until now, although I assume that some compiler would
have eventually started to complain about that.
Attachments:
0001-Use-the-correct-data-type-in-visibilitymap_get_statu.patchtext/plain; charset=us-asciiDownload
From 8dd0ddc9760e1ecee3ea4eea96bb4ab80c940478 Mon Sep 17 00:00:00 2001
From: Julien Rouhaud <julien.rouhaud@free.fr>
Date: Thu, 24 Jul 2025 15:32:34 +0800
Subject: [PATCH] Use the correct data type in visibilitymap_get_status
Oversight in a892234f830e which changed the surrouding function to return an
uint8 rather than a bool.
---
src/backend/access/heap/visibilitymap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/backend/access/heap/visibilitymap.c b/src/backend/access/heap/visibilitymap.c
index 745a04ef26e..e826e8e46c6 100644
--- a/src/backend/access/heap/visibilitymap.c
+++ b/src/backend/access/heap/visibilitymap.c
@@ -364,7 +364,7 @@ visibilitymap_get_status(Relation rel, BlockNumber heapBlk, Buffer *vmbuf)
{
*vmbuf = vm_readbuf(rel, mapBlock, false);
if (!BufferIsValid(*vmbuf))
- return false;
+ return 0;
}
map = PageGetContents(BufferGetPage(*vmbuf));
--
2.50.1
On Thu, Jul 24, 2025 at 03:50:17PM +0800, Julien Rouhaud wrote:
I was reading the visibility map code and noticed that
visibilitymap_get_status() wasn't updated in a892234f830e AFAICS (Cc Robert and
Sawada-san) to return an empty set of flags rather than false in one code path,
so simple patch attached. Both have the same value so that likely explains why
it got unnoticed until now, although I assume that some compiler would
have eventually started to complain about that.
+1, I'll go commit this.
--
nathan
On Thu, Jul 24, 2025 at 09:56:00AM -0500, Nathan Bossart wrote:
On Thu, Jul 24, 2025 at 03:50:17PM +0800, Julien Rouhaud wrote:
I was reading the visibility map code and noticed that
visibilitymap_get_status() wasn't updated in a892234f830e AFAICS (Cc Robert and
Sawada-san) to return an empty set of flags rather than false in one code path,
so simple patch attached. Both have the same value so that likely explains why
it got unnoticed until now, although I assume that some compiler would
have eventually started to complain about that.+1, I'll go commit this.
Thanks.