Redundant initialization of table AM oid in relcache
Started by Jingtang Zhangabout 1 year ago1 messages
Hi~
Just found 'relam' field is assigned twice during relcache initialization. We
have a specific area for initialization AM related stuff several lines later:
/*
* initialize the table am handler
*/
relation->rd_rel->relam = HEAP_TABLE_AM_OID;
relation->rd_tableam = GetHeapamTableAmRoutine();
so previous assignment seems not needed and can be removed.
—
Regards, Jingtang

Attachments:
0001-Remove-redundant-initialization-of-table-AM-oid-in-r.patchapplication/octet-stream; name=0001-Remove-redundant-initialization-of-table-AM-oid-in-r.patch; x-unix-mode=0644Download
From 0ab2cb0d85f0f2a3a4263f58b6cbc10ae489989d Mon Sep 17 00:00:00 2001
From: Jingtang Zhang <mrdrivingduck@gmail.com>
Date: Thu, 21 Nov 2024 11:52:32 +0800
Subject: [PATCH] Remove redundant initialization of table AM oid in relcache
The oid of table AM is assigned twice during initialization of
relcache. Since we have a specific area for initializing table AM
related stuff, like table AM handler, the one outside this area is
removed. Involved from table AM infrastructure 8586bf7e.
---
src/backend/utils/cache/relcache.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 342467fd18..ddf68ae57f 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -1939,7 +1939,6 @@ formrdesc(const char *relationName, Oid relationReltype,
relation->rd_rel->relallvisible = 0;
relation->rd_rel->relkind = RELKIND_RELATION;
relation->rd_rel->relnatts = (int16) natts;
- relation->rd_rel->relam = HEAP_TABLE_AM_OID;
/*
* initialize attribute tuple form
--
2.39.5 (Apple Git-154)