Re: PgStat_HashKey padding issue when passed by reference - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: PgStat_HashKey padding issue when passed by reference
Date
Msg-id CAA5RZ0uAa2e28P4K4sZWC2Oo2HS3DoF7SyQ=wcvGO+RK-pe6gw@mail.gmail.com
Whole thread Raw
In response to Re: PgStat_HashKey padding issue when passed by reference  (Michael Paquier <michael@paquier.xyz>)
Responses Re: PgStat_HashKey padding issue when passed by reference
List pgsql-hackers
> On Mon, Sep 15, 2025 at 04:47:27PM -0500, Sami Imseih wrote:
> > Just to confirm, you are saying we are unlikely to ever add a new field
> > to the key. Is that correct?
>
> I would rather avoid that, yes.

7d85d87f4d5c35 added code to clear the padding bytes with memset
in anticipation that the key could be changed in the future, in a way
that padding will be introduced. So, if we are changing thoughts on
this, we should add additional comments next to
```
+ * NB: We assume that this struct contains no padding.
```
to enforce that the hash stored in objid should be used to
support additional fields, rather than adding a field directly
into the key. Will help future patch reviews/designs.

--
Sami



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: GetNamedLWLockTranche crashes on Windows in normal backend
Next
From: Nathan Bossart
Date:
Subject: Re: GetNamedLWLockTranche crashes on Windows in normal backend