From: Michael Paquier Date: Wed, 8 Apr 2026 23:49:36 +0000 (+0900) Subject: Reduce presence of syscache.h in src/include/ X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e0fa5bd146564d9d05cac15bdcba65b7860d2b91;p=thirdparty%2Fpostgresql.git Reduce presence of syscache.h in src/include/ ee642cccc43c has added syscache.h in inval.h and objectaddress.h, enlarging by a lot the footprint of this header, particularly via objectaddress.h. A change in syscache.h would cause a lot more files to be recompiled. This commit reduces the presence of syscache.h by switching to a direct use of syscache_ids.h in inval.h and objectaddress.h, where the enum SysCacheIdentifier is defined. genbki.pl gains an #ifndef block for this header, so as its inclusion is more controlled. Reported-by: Andres Freund Discussion: https://postgr.es/m/vlcexdcimsmvu3aplt2yxpfndkgtuvjsrms2fdl46rbw3k2kug@drspkoxlaije --- diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index 48c6805f752..86f3135f9c7 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"; @@ -833,7 +836,10 @@ 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 "#define SysCacheSize ($last_syscache + 1)\n\n"; + +# Closing boilerplate for syscache_ids.h +print $syscache_ids_fh "#endif\t\t\t\t\t\t\t/* SYSCACHE_IDS_H */\n"; print $syscache_info_fh "};\n"; diff --git a/src/include/catalog/objectaddress.h b/src/include/catalog/objectaddress.h index b549be2d523..1f965e1faef 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 5f64fb20477..735e42f7310 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;