Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v2ufT-008llZ-8i for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Sep 2025 16:54:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v2ufO-00EzbR-LS for pgsql-hackers@arkaria.postgresql.org; Sun, 28 Sep 2025 16:54:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v2ufN-00EzbH-Ja for pgsql-hackers@lists.postgresql.org; Sun, 28 Sep 2025 16:54:31 +0000 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]) by makus.postgresql.org with smtp (Exim 4.96) (envelope-from ) id 1v2ufL-000MtF-0I for pgsql-hackers@postgresql.org; Sun, 28 Sep 2025 16:54:29 +0000 Received: from phl-compute-11.internal (phl-compute-11.internal [10.202.2.51]) by mailfhigh.stl.internal (Postfix) with ESMTP id 4743D7A002B; Sun, 28 Sep 2025 12:54:26 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-11.internal (MEProxy); Sun, 28 Sep 2025 12:54:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm3; t=1759078466; x= 1759164866; bh=h21bCSvezZvJ3s0YDvsfQdmohbIehYRRlJ3WcNP5mqQ=; b=q mjRN2alQV3HElUnI0koAuQZIx9sbawYXGfzQ3dc7pF8Q9NONTTTJR9vHIUtzi67d dm88vQC0z02270SoHJaMh05jJuEtzLg+cmZ1kXl+HO9X3JU6rmWw8GFi3HizuvcQ DZfA3Ls+pEDbYz8jBCiHoiYgI2AaKpGXbaPHn2cQKEOj/+vX3m5pq8ZdU/+7Fclq lhTHiXyeTtBlWTM8UdTPbo1kDatcl/UHkAvr8OgDbdAp8BwfYq1TBC6my/JnRV8V /j8na35N2EjhUzvjYT+Oo5yippJr6rpwMFToLyuSh7FcSvLiH158RK4Z/YUHdQeB vYn0IqFsxbAUl65jsYOnw== 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:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1759078466; x=1759164866; bh=h 21bCSvezZvJ3s0YDvsfQdmohbIehYRRlJ3WcNP5mqQ=; b=IjwBxU4v+7W3i3Mww X6zkwuwvPRdHOAe4srEm8+cFdIY5TLpNamlBHcW6aN9ittHFzpN9Qo+e2tnYyKy0 Z7st+NYYBVtcQ6s2cyGjKukNTyAmEMWpqs9T8im/Gc1ecJeKTo/PFzvZQrrtuyZI CntP9B+xBpghvCUsjposvtRh0ax5L/cLcv8Yrd3AJjhMQqY0cXmiKmJ2ZMW1T3ou i12+ngebVMQN0uKHvNcIwyhhSxfCKeKFGVtCwm/M0fiBAVnfwssNJfpQiuUHpghC FN+ZM0RebETGCk/H33zHnrgXHCUkR1h83tsgZJvzJyXQ+gf3sDsXLNhYJV3dUoV3 xzWbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdejheeiiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfggtggugfgjsehmkeerredttdejnecuhfhrohhmpemllhhvrghrohcu jfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgeqnecuggftrf grthhtvghrnhepgedutedujeehudevveegheejgeelveevvedvuedtjedtkeeuhfehheeg vedtjeetnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvges khhurhhilhgvmhhurdguvgdpnhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouh htpdhrtghpthhtohepphgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgpdhrtghpthht ohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpth htohepthhglhesshhsshdrphhghhdrphgrrdhush X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 28 Sep 2025 12:54:25 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1759078463; bh=ZyzVxsQzeruBaXtJUAfiNCouC8Icd+ArtDe/qHl/8hs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=KGK/bSUx215/rXCvjJ1igkLkITiY2+GZiBLMCdaVefQh+YaRfleAm9CvJOnmpAqRB JoLFnHeFPFYfGMwV532MWepLJFn7MTDn2vibVeKuDUsC/bikmSvwbclHfTOmZ/8Gso me9ThklaQ9LhprkEK2jLGMq0TWYp1GZ2ANbHFhBWDUZ7sAnhr+uUuQDlXZRClV3XLx /mglErvw2xFstbxboFk5DUA6dVw+YWVVRBuKdfx06Mz5G0n5YMfbGMSLeIGiGveimj FI1qlc3CVcKY1CzIJWxT3LIo6OUt0qsP37YtcraKARnHHnGgfie2JXnnLTDCPEccaC XxAnRzE0vJJfw== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 20C2B78; Sun, 28 Sep 2025 18:54:23 +0200 (CEST) Date: Sun, 28 Sep 2025 18:54:23 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: Tom Lane Cc: Peter Eisentraut , pgsql-hackers Subject: Re: allow benign typedef redefinitions (C11) Message-ID: <202509281643.jcbwanjuy7yh@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="smaq5tawmbjl6jcu" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <832524.1759070119@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --smaq5tawmbjl6jcu Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2025-Sep-28, Tom Lane wrote: > =?UTF-8?Q?=C3=81lvaro_Herrera?= writes: > > The changes to inet.h and varbit.h are surprising, but required. > > Why? Those headers compile now, and you've not removed any includes > that they might indirectly depend on. That's true. > If what you mean is that some of the macros in these headers require > varatt.h to be used, I do not agree that that means we should put > varatt.h into these headers. We've frequently relied on exactly > that property of macro definitions to avoid excessive or circular > inclusions. Moreover, even if we wanted to change that policy, > I know of no simple way to check it. We used to have a script called pgdefine that would create a .c file that would expand all macros defined in a header, and then ensure that the C file compiled. It was removed only recently (Dec. 2024), in commit 5af699066f81, though it's true that apparently nobody had used in a while. > I think what we're trying to do here is reduce the #includes of > header files to be just enough to compile the headers themselves. > That will bleed out into more #include's required in .c files, > but that's fine by me. Ok, that requires adding varatt.h to just two .c files -- attached. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ --smaq5tawmbjl6jcu Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="v2-0001-Remove-genam.h-s-dependency-on-relcache.h-and-tid.patch" From 5860cc0d4a1e4f9eace2eb521f0f7416e97709ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Herrera?= Date: Sun, 28 Sep 2025 11:15:51 +0200 Subject: [PATCH v2] Remove genam.h's dependency on relcache.h and tidbitmap.h --- contrib/btree_gist/btree_bit.c | 1 + src/backend/utils/adt/network_spgist.c | 1 + src/include/access/amapi.h | 2 ++ src/include/access/genam.h | 6 ++++-- src/include/access/nbtree.h | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/btree_gist/btree_bit.c b/contrib/btree_gist/btree_bit.c index 0df2ae20d8b..9199f886097 100644 --- a/contrib/btree_gist/btree_bit.c +++ b/contrib/btree_gist/btree_bit.c @@ -8,6 +8,7 @@ #include "utils/fmgrprotos.h" #include "utils/sortsupport.h" #include "utils/varbit.h" +#include "varatt.h" /* GiST support functions */ PG_FUNCTION_INFO_V1(gbt_bit_compress); diff --git a/src/backend/utils/adt/network_spgist.c b/src/backend/utils/adt/network_spgist.c index 602276a35c3..a84747d9275 100644 --- a/src/backend/utils/adt/network_spgist.c +++ b/src/backend/utils/adt/network_spgist.c @@ -37,6 +37,7 @@ #include "catalog/pg_type.h" #include "utils/fmgrprotos.h" #include "utils/inet.h" +#include "varatt.h" static int inet_spg_node_number(const inet *val, int commonbits); diff --git a/src/include/access/amapi.h b/src/include/access/amapi.h index 2b4482dc1e6..63dd41c1f21 100644 --- a/src/include/access/amapi.h +++ b/src/include/access/amapi.h @@ -15,6 +15,8 @@ #include "access/cmptype.h" #include "access/genam.h" #include "access/stratnum.h" +#include "nodes/nodes.h" +#include "nodes/pg_list.h" /* * We don't wish to include planner header files here, since most of an index diff --git a/src/include/access/genam.h b/src/include/access/genam.h index ac62f6a6abd..e23eb04650b 100644 --- a/src/include/access/genam.h +++ b/src/include/access/genam.h @@ -17,15 +17,17 @@ #include "access/htup.h" #include "access/sdir.h" #include "access/skey.h" -#include "nodes/tidbitmap.h" #include "storage/buf.h" #include "storage/lockdefs.h" -#include "utils/relcache.h" #include "utils/snapshot.h" /* We don't want this file to depend on execnodes.h. */ typedef struct IndexInfo IndexInfo; typedef struct TupleTableSlot TupleTableSlot; +/* or tidbitmap.h */ +typedef struct TIDBitmap TIDBitmap; +/* or relcache.h */ +typedef struct RelationData *Relation; /* diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index 9ab467cb8fd..db1345f54c8 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -22,6 +22,7 @@ #include "catalog/pg_index.h" #include "lib/stringinfo.h" #include "storage/bufmgr.h" +#include "storage/dsm.h" #include "storage/shm_toc.h" #include "utils/skipsupport.h" -- 2.47.3 --smaq5tawmbjl6jcu--