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

From Michael Paquier
Subject Re: PgStat_HashKey padding issue when passed by reference
Date
Msg-id aL-Q8CC5KscJS_Oq@paquier.xyz
Whole thread Raw
In response to Re: PgStat_HashKey padding issue when passed by reference  (Sami Imseih <samimseih@gmail.com>)
Responses Re: PgStat_HashKey padding issue when passed by reference
List 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

Attachment

pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: plan shape work
Next
From: Sami Imseih
Date:
Subject: Re: PgStat_HashKey padding issue when passed by reference