pgstat-hashkey-padding.patch

text/x-diff

Filename: pgstat-hashkey-padding.patch
Type: text/x-diff
Part: 0
Message: Re: PgStat_HashKey padding issue when passed by reference

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/include/utils/pgstat_internal.h 9 0
diff --git a/src/include/utils/pgstat_internal.h b/src/include/utils/pgstat_internal.h
index 6cf00008f633..d5869299fa86 100644
--- a/src/include/utils/pgstat_internal.h
+++ b/src/include/utils/pgstat_internal.h
@@ -57,6 +57,15 @@ typedef struct PgStat_HashKey
 								 * identifier. */
 } PgStat_HashKey;
 
+/*
+ * PgStat_HashKey should not have any padding.  Checking that the structure
+ * size matches with the sum of each field is a check simple enough to
+ * enforce this policy.
+ */
+StaticAssertDecl((sizeof(PgStat_Kind) + sizeof(uint64) + sizeof(Oid)) ==
+				 sizeof(PgStat_HashKey),
+				 "PgStat_HashKey should have no padding");
+
 /*
  * Shared statistics hash entry. Doesn't itself contain any stats, but points
  * to them (with ->body). That allows the stats entries themselves to be of