Re: PgStat_HashKey padding issue when passed by reference
Sami Imseih <samimseih@gmail.com>
From: Sami Imseih <samimseih@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-09-04T16:50:15Z
Lists: pgsql-hackers
> > This looks like a compiler bug, we tested multiple ways to workaround: > > Padding bytes aren't guaranteed to be zeroed, unless you take care to zero > them out with memset or such. That's not a compiler bug. Perhaps calling this a compiler bug is not appropriate. However, memset is in fact called when the key is created ``` /* clear padding */ memset(&key, 0, sizeof(struct PgStat_HashKey)); ``` but the zeroed out padding bytes are not retained when the key is passed by value. This is why the proposal is to pass the key by reference. -- Sami Imseih Amazon Web Services (AWS)
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