On Wed, Sep 28, 2022 at 9:40 AM Dilip Kumar <dilipbal...@gmail.com> wrote:
>
> On Wed, Sep 28, 2022 at 2:59 AM Tom Lane <t...@sss.pgh.pa.us> wrote:
> >
> > ... also, lapwing's not too happy [1].  The alter_table test
> > expects this to yield zero rows, but it doesn't:
>
> By looking at regression diff as shown below, it seems that we are
> able to get the relfilenode from the Oid using
> pg_relation_filenode(oid) but the reverse mapping
> pg_filenode_relation(reltablespace, relfilenode) returned NULL.
>

It was a silly mistake, I used the F_OIDEQ function instead of
F_INT8EQ. Although this was correct on the 0003 patch where we have
removed the tablespace from key, but got missed in this :(

I have locally reproduced this in a 32 bit machine consistently and
the attached patch is fixing the issue for me.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com
From 50c5695843c7ab1b6945d4e7237da3812085c85a Mon Sep 17 00:00:00 2001
From: Dilip Kumar <dilip.ku...@enterprisedb.com>
Date: Wed, 28 Sep 2022 13:39:45 +0530
Subject: [PATCH] Fix silly mistake, use F_INT8EQ function for relfilenode
 search

---
 src/backend/utils/cache/relfilenumbermap.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/backend/utils/cache/relfilenumbermap.c b/src/backend/utils/cache/relfilenumbermap.c
index 2e0acf9..11427ba 100644
--- a/src/backend/utils/cache/relfilenumbermap.c
+++ b/src/backend/utils/cache/relfilenumbermap.c
@@ -88,7 +88,6 @@ static void
 InitializeRelfilenumberMap(void)
 {
 	HASHCTL		ctl;
-	int			i;
 
 	/* Make sure we've initialized CacheMemoryContext. */
 	if (CacheMemoryContext == NULL)
@@ -97,17 +96,20 @@ InitializeRelfilenumberMap(void)
 	/* build skey */
 	MemSet(&relfilenumber_skey, 0, sizeof(relfilenumber_skey));
 
-	for (i = 0; i < 2; i++)
-	{
-		fmgr_info_cxt(F_OIDEQ,
-					  &relfilenumber_skey[i].sk_func,
-					  CacheMemoryContext);
-		relfilenumber_skey[i].sk_strategy = BTEqualStrategyNumber;
-		relfilenumber_skey[i].sk_subtype = InvalidOid;
-		relfilenumber_skey[i].sk_collation = InvalidOid;
-	}
-
+	fmgr_info_cxt(F_OIDEQ,
+				  &relfilenumber_skey[0].sk_func,
+				  CacheMemoryContext);
+	relfilenumber_skey[0].sk_strategy = BTEqualStrategyNumber;
+	relfilenumber_skey[0].sk_subtype = InvalidOid;
+	relfilenumber_skey[0].sk_collation = InvalidOid;
 	relfilenumber_skey[0].sk_attno = Anum_pg_class_reltablespace;
+
+	fmgr_info_cxt(F_INT8EQ,
+				  &relfilenumber_skey[1].sk_func,
+				  CacheMemoryContext);
+	relfilenumber_skey[1].sk_strategy = BTEqualStrategyNumber;
+	relfilenumber_skey[1].sk_subtype = InvalidOid;
+	relfilenumber_skey[1].sk_collation = InvalidOid;
 	relfilenumber_skey[1].sk_attno = Anum_pg_class_relfilenode;
 
 	/*
-- 
1.8.3.1

Reply via email to