Re: plan shape work

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: plan shape work
Дата
Msg-id 2805458.1759979077@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: plan shape work  (Richard Guo <guofenglinux@gmail.com>)
Ответы Re: plan shape work
Список pgsql-hackers
Richard Guo <guofenglinux@gmail.com> writes:
> Does it make sense to explicitly initialize glob->subplanNames in
> standard_planner()?  I understand this might seem pointless since
> makeNode() zeroes all fields by default, but subplanNames is currently
> the only field in PlannerGlobal that isn't explicitly initialized.  I
> previously committed a patch (2c0ed86d3) to ensure all PlannerGlobal
> fields are explicitly initialized, and I'd prefer to maintain that
> consistency.

We don't really have consensus on that point, I fear.  I like the
initialize-em-all-explicitly approach, but some other senior hackers
think it's useless verbiage.

My argument for doing it explicitly is that when adding a new field
to a struct, one frequently searches for existing references to a
nearby field.  Without initialize-em-all, this risks missing places
where you need to initialize your new field.  If you'd only set it
to zero, then fine ... but what if that particular place needs some
other initial value?  So I think omitting initializations-to-zero
risks future bugs of omission.  Some other folk don't find that
argument very compelling, though.

            regards, tom lane



В списке pgsql-hackers по дате отправления: