From dca7c05924a3bdda1173428a4bded22b09a8f6fa Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 20 Nov 2026 14:59:58 +0100 Subject: [PATCH v2 5/7] Fixes for alloc_size attribute [bootstrap] As of commit 6a3da13d376, FormData_pg_attribute has 4 bytes of trailing padding, and so sizeof(FormData_pg_attribute) is different from ATTRIBUTE_FIXED_PART_SIZE. The compiler flags it in this one place. Changing to sizeof(FormData_pg_attribute) also makes this code consistent with tupdesc.c, which also allocates the FormData_pg_attribute portions of the tuple descriptor that way. (ATTRIBUTE_FIXED_PART_SIZE is otherwise only used for memcpy/memmove/memset, not for sizing allocations.) Discussion: https://www.postgresql.org/message-id/flat/cadec43a-d031-41cb-b887-3b4a29720017%40eisentraut.org --- src/backend/bootstrap/bootstrap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 00786d8c0fa..63cfc25bda0 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -1106,15 +1106,15 @@ boot_get_role_oid(const char *rolname) /* ---------------- * AllocateAttribute * - * Note: bootstrap never sets any per-column ACLs, so we only need - * ATTRIBUTE_FIXED_PART_SIZE space per attribute. + * Note: bootstrap never sets any variable-length fields in pg_attribute, so + * we only need to allocate the fixed portion. * ---------------- */ static Form_pg_attribute AllocateAttribute(void) { return (Form_pg_attribute) - MemoryContextAllocZero(TopMemoryContext, ATTRIBUTE_FIXED_PART_SIZE); + MemoryContextAllocZero(TopMemoryContext, sizeof(FormData_pg_attribute)); } /* -- 2.56.0