> On Thu, Aug 31, 2023 at 5:34 PM Richard Guo <guofenglinux@gmail.com> wrote: > > > > While working on a bug in expandRecordVariable() I noticed that in the > > switch statement for case RTE_SUBQUERY we initialize struct ParseState > > with {0} while for case RTE_CTE we do that with MemSet. I understand > > that there is nothing wrong with this, just cannot get away with the > > inconsistency inside the same function (sorry for the nitpicking). > > > > Do we have a preference for how to initialize structures? From 9fd45870 > > it seems that we prefer to {0}. So here is a trivial patch doing that.
It seems to have been deliberately left that way in the wake of that commit, see:
(If so, it deserves a comment to keep people from trying to change it...)
Thanks for pointing this out. Yeah, struct initialization does not work for some cases with padding bits, such as for a hash key we need to clear the padding too.
The case in expandRecordVariable() mentioned here should be safe though, maybe this is an omission from 9fd45870?