Re: PgStat_HashKey padding issue when passed by reference

Sami Imseih <samimseih@gmail.com>

From: Sami Imseih <samimseih@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-09-16T19:38:20Z
Lists: 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



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Document and check that PgStat_HashKey has no padding