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-11T15:21:45Z
Lists: pgsql-hackers
> On Mon, Sep 08, 2025 at 09:36:52PM -0500, Sami Imseih wrote: > > But my concern is the flexibility of this approach. If someone is to add an > > OID field next, they will not be able to as that will be introducing > > padding. On the other hand, passing the key by reference and > > documenting the reason in pgstat_shmem.c will not lose this > > flexibility. > > I don't mind discarding the static assertion idea, but at the end what > counts for me here is that I don't want to sacrifice future changes in > the pgstats code that would always require passing around the hash key > by reference. I don't see how this improves the situation, but will just make it more difficult to add a new field that requires padding in the future. If we are documenting either way, I rather that we just document the need to pass a key by reference, which is the pattern used in other areas ( see pgss_store and entry_alloc in pg_stat_statements.c ) Others may have a different opinion. -- Sami
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Document and check that PgStat_HashKey has no padding
- 3cd3a039da7f 19 (unreleased) landed