Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pyV72-0001Vw-Gh for pgsql-hackers@arkaria.postgresql.org; Mon, 15 May 2023 10:07:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pyV62-0005qw-8Y for pgsql-hackers@arkaria.postgresql.org; Mon, 15 May 2023 10:06:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pyV61-0005qm-8t for pgsql-hackers@lists.postgresql.org; Mon, 15 May 2023 10:06:26 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pyV5s-002r8O-U9 for pgsql-hackers@lists.postgresql.org; Mon, 15 May 2023 10:06:24 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id D0060320024A; Mon, 15 May 2023 06:06:12 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 May 2023 06:06:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1684145172; x= 1684231572; bh=TZgOBP9Z3Z3rYDJlMr+DDum/bn7hyqsvVC3oF2x8QmM=; b=X rAXeGpG3VrKMaCKOwfBfXXHIunQVOyFOHcz95l/4YTME+JPLQkFCON5VbCsyFBOc 0lz65PmOYUeWSrHUUqWV2nE70jeGiz0D6QNhE+hEc0ZTxCcN9PO247mw3q9e/pyx QZp00PudB4DQE8nv738duVUh6U+egiCh34leyGvQCEajpqwZgnqRxH/bKtchwQk/ iOsoR/COz3OswdXCiKxfC6h1yWILyP58acQp645RZYaUDsWSnRNawwBMw6PqUgMs QnxAOMCbv18a9q+BL5BmJxYW+wR09qP/L14EcDpP4UEd9YUv4zyjZCZ8QkGtxWa2 /DeFJvkIjC8pKbtJAsnKg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeehjedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 May 2023 06:06:11 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id C3013149; Mon, 15 May 2023 12:06:07 +0200 (CEST) Date: Mon, 15 May 2023 12:06:07 +0200 From: Alvaro Herrera To: Tomas Vondra Cc: Justin Pryzby , Matthias van de Meent , pgsql-hackers@lists.postgresql.org Subject: Re: Missing update of all_hasnulls in BRIN opclasses Message-ID: <20230515100607.uftic7fsmz7blkfk@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <141202ca-4c92-e294-0bfe-e1709ee2f71b@enterprisedb.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-May-07, Tomas Vondra wrote: > > Álvaro wrote: > >> In backbranches, the new field to BrinMemTuple needs to be at the end of > >> the struct, to avoid ABI breakage. > > Unfortunately, this is not actually possible :-( > > The BrinMemTuple has a FLEXIBLE_ARRAY_MEMBER at the end, so we can't > place anything after it. I think we have three options: > > a) some other approach? - I really can't see any, except maybe for going > back to the previous approach (i.e. encoding the info using the existing > BrinValues allnulls/hasnulls flags) Actually, mine was quite the stupid suggestion: the BrinMemTuple already has a 3 byte hole in the place where you originally wanted to add the flag: struct BrinMemTuple { _Bool bt_placeholder; /* 0 1 */ /* XXX 3 bytes hole, try to pack */ BlockNumber bt_blkno; /* 4 4 */ MemoryContext bt_context; /* 8 8 */ Datum * bt_values; /* 16 8 */ _Bool * bt_allnulls; /* 24 8 */ _Bool * bt_hasnulls; /* 32 8 */ BrinValues bt_columns[]; /* 40 0 */ /* size: 40, cachelines: 1, members: 7 */ /* sum members: 37, holes: 1, sum holes: 3 */ /* last cacheline: 40 bytes */ }; so putting it there was already not causing any ABI breakage. So, the solution to this problem of not being able to put it at the end is just to return the struct to your original formulation. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "La primera ley de las demostraciones en vivo es: no trate de usar el sistema. Escriba un guión que no toque nada para no causar daños." (Jakob Nielsen)