Re: PgStat_HashKey padding issue when passed by reference

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PgStat_HashKey padding issue when passed by reference
Date: 2025-09-09 02:29:04
Message-ID: aL-Q8CC5KscJS_Oq@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 08, 2025 at 09:20:14PM -0500, Sami Imseih wrote:
> The following will fail the assert since padding is needed for the
> new Oid member.
>
> @@ -53,6 +53,7 @@ typedef struct PgStat_HashKey
> {
> PgStat_Kind kind; /* statistics entry kind */
> Oid dboid; /* database
> ID. InvalidOid for shared objects. */
> + Oid field1;
> uint64 objid; /* object ID (table,
> function, etc.), or
>
> This will not fail the assert, since no padding is needed for the new member.
>
> @@ -53,6 +53,7 @@ typedef struct PgStat_HashKey
> {
> PgStat_Kind kind; /* statistics entry kind */
> Oid dboid; /* database
> ID. InvalidOid for shared objects. */
> + uint64 field1;
> uint64 objid; /* object ID (table,
> function, etc.), or

Exactly. Hence my proposal of static assertion is doing exactly the
job I want it to do :)
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-09-09 02:36:52 Re: PgStat_HashKey padding issue when passed by reference
Previous Message Richard Guo 2025-09-09 02:22:40 Re: plan shape work