Re: Add explicit initialization for all PlannerGlobal fields

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add explicit initialization for all PlannerGlobal fields
Date: 2025-05-13 11:26:32
Message-ID: CAApHDvp3R1CcmZ2WxsvVANZu05104gTPV=biKm+ix-H+-2YmNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 13 May 2025 at 04:03, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> While adding a new field to PlannerGlobal in another patch, I noticed
> that although most fields are explicitly initialized, a few are not.
> This doesn't cause any functional issues, since makeNode() zeroes all
> fields by default. However, the inconsistency stood out to me, so I
> wrote the attached patch to explicitly initialize the remaining fields
> for clarity and consistency.
>
> Does this seem worthwhile? Or should we simply rely on makeNode() for
> zero-initialization and consider this unnecessary?

These should be zeroed explicitly.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-05-13 11:33:25 Re: Add an option to skip loading missing publication to avoid logical replication failure
Previous Message Fujii Masao 2025-05-13 11:13:00 Re: Allow reading LSN written by walreciever, but not flushed yet