Обсуждение: Remove redundant initialization of smgr pointer for relcache

Поиск
Список
Период
Сортировка

Remove redundant initialization of smgr pointer for relcache

От
Jingtang Zhang
Дата:
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


Вложения

Re: Remove redundant initialization of smgr pointer for relcache

От
Zsolt Parragi
Дата:
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?