From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Should we use MemSet or {0} for struct initialization? |
Date: | 2023-09-19 10:39:13 |
Message-ID: | CAMbWs4-84LLhy0uXRvw9dSM7EJVSVwdTVRUtP6g6+y4HHsMvyg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Sep 19, 2023 at 5:37 PM Peter Eisentraut <peter(at)eisentraut(dot)org>
wrote:
> On 31.08.23 10:32, Richard Guo 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.
> > And with a rough scan the MemSet calls in pg_stat_get_backend_subxact()
> > can also be replaced with {0}, so include that in the patch too.
>
> The first part (parse_target.c) was already addressed by e0e492e5a9. I
> have applied the second part (pgstatfuncs.c).
Thanks for pushing this.
Thanks
Richard
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2023-09-19 10:44:04 | Re: CHECK Constraint Deferrable |
Previous Message | jian he | 2023-09-19 10:37:45 | Re: remaining sql/json patches |