]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Reduce presence of syscache.h in src/include/
authorMichael Paquier <michael@paquier.xyz>
Wed, 8 Apr 2026 23:49:36 +0000 (08:49 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 8 Apr 2026 23:49:36 +0000 (08:49 +0900)
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 <andres@anarazel.de>
Discussion: https://postgr.es/m/vlcexdcimsmvu3aplt2yxpfndkgtuvjsrms2fdl46rbw3k2kug@drspkoxlaije

src/backend/catalog/genbki.pl
src/include/catalog/objectaddress.h
src/include/utils/inval.h

index 48c6805f75279614a13dbf0046de9cbf9efeee34..86f3135f9c79e35213bbdff417983390ed004c79 100644 (file)
@@ -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";
 
index b549be2d523e4d90ee0d0e4300e9f6d6f1b7116a..1f965e1faef418b08b1485358a864e4006bce64c 100644 (file)
 #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.
index 5f64fb20477628586f39c84e6b3d943d40928361..735e42f731088cca449537aa6d355a74ea2fb36d 100644 (file)
@@ -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;