Remove redundant initialization of smgr pointer for relcache

Started by Jingtang Zhangabout 1 year ago2 messageshackers
Jump to latest
#1Jingtang Zhang
mrdrivingduck@gmail.com

Hi~

We seem to have a reduntant initialization of rd_smgr for a newly created
relcache entry. Commonly, the pointer is assigned as NULL after a relcache
is palloc'ed. But this one seems unnecessary because the rd_smgr has already
been initialized by earlier AllocateRelationDesc. Propose a patch for it.

--
Regards, Jingtang

Attachments:

t52635_1
0001-Remove-redundant-initialization-of-smgr-pointer-for-.patchapplication/octet-stream; name=0001-Remove-redundant-initialization-of-smgr-pointer-for-.patch; x-unix-mode=0644Download+0-4
#2Zsolt Parragi
zsolt.parragi@percona.com
In reply to: Jingtang Zhang (#1)
Re: Remove redundant initialization of smgr pointer for relcache

Hello!

This is a simple change, and should work correctly.

However, I think I would do more, as this part of the code is just confusing.

* AllocateRelationDesc only has one caller
* Its description comment only mentions some things it does, not all
of them. The call site explains it differently, but also not
completely.

I would at least also modify the comments so that they are only at one
place and explain the function correctly. But maybe it would be even
better to remove this function completely or to modify it so it's
usable at multiple places?