On Fri, Mar 27, 2026 at 05:17:49PM -0400, Andres Freund wrote: > With ee642cccc43c a change to syscache.h rebuilds 632 files. With ee642cccc43c > reverted, it's just 196.
Point received. > Leaving build impact aside, I don't think it's good to expose a relatively low > level detail like syscache.h to most of the backend. It's imo something that > only .c, never .h files should need. And as we already define SysCacheIdentifier in its own header, this can be answered with the attached, removing the need for syscache.h in objectaddress.h and inval.h. The trick in genbki.pl was needed to avoid some noise due to -Wenum-compare in a couple of files. Would you prefer a different option? That would protect from large rebuilds should syscache.h be touched in some way. A different option would be to move get_object_catcache_oid() and get_object_catcache_name() out of objectaddress.h to a different header, limiting the scope of what's pulled in objectaddress.h. Anyway, the attached should take care of your main concern, I guess? -- Michael
From d5eef6cc0b96ba4bdbab1b388ca24f7a35b1e7a2 Mon Sep 17 00:00:00 2001 From: Michael Paquier <[email protected]> Date: Mon, 6 Apr 2026 08:13:46 +0900 Subject: [PATCH] Remove some syscache includes --- src/include/catalog/objectaddress.h | 2 +- src/include/utils/inval.h | 2 +- src/backend/catalog/genbki.pl | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/include/catalog/objectaddress.h b/src/include/catalog/objectaddress.h index b549be2d523e..1f965e1faef4 100644 --- a/src/include/catalog/objectaddress.h +++ b/src/include/catalog/objectaddress.h @@ -14,10 +14,10 @@ #define OBJECTADDRESS_H #include "access/htup.h" +#include "catalog/syscache_ids.h" #include "nodes/parsenodes.h" #include "storage/lockdefs.h" #include "utils/relcache.h" -#include "utils/syscache.h" /* * An ObjectAddress represents a database object of any type. diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h index 5f64fb204776..735e42f73108 100644 --- a/src/include/utils/inval.h +++ b/src/include/utils/inval.h @@ -15,9 +15,9 @@ #define INVAL_H #include "access/htup.h" +#include "catalog/syscache_ids.h" #include "storage/relfilelocator.h" #include "utils/relcache.h" -#include "utils/syscache.h" extern PGDLLIMPORT int debug_discard_caches; diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index 48c6805f7527..80ef3bcd1685 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -795,7 +795,10 @@ print $fk_info "};\n\n#endif\t\t\t\t\t\t\t/* SYSTEM_FK_INFO_H */\n"; # Now generate syscache info print_boilerplate($syscache_ids_fh, "syscache_ids.h", "SysCache identifiers"); -print $syscache_ids_fh "typedef enum SysCacheIdentifier +print $syscache_ids_fh "#ifndef SYSCACHE_IDS_H +#define SYSCACHE_IDS_H + +typedef enum SysCacheIdentifier { \tSYSCACHEID_INVALID = -1,\n"; @@ -834,6 +837,7 @@ foreach my $syscache (sort keys %syscaches) print $syscache_ids_fh "} SysCacheIdentifier;\n"; print $syscache_ids_fh "#define SysCacheSize ($last_syscache + 1)\n"; +print $syscache_ids_fh "#endif\t\t/* SYSCACHE_IDS_H */"; print $syscache_info_fh "};\n"; -- 2.53.0
signature.asc
Description: PGP signature
