This is an automated email from the ASF dual-hosted git repository.

reshke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit d6b9534dd9dfe2159704b11c9103880cfe89b037
Author: Tom Lane <[email protected]>
AuthorDate: Mon Feb 9 10:02:23 2026 -0500

    Add a syscache on pg_extension.oid.
    
    An upcoming patch requires this cache so that it can track updates
    in the pg_extension catalog.  So far though, the EXTENSIONOID cache
    only exists in v18 and up (see 490f869d9).  We can add it in older
    branches without an ABI break, if we are careful not to disturb the
    numbering of existing syscache IDs.
    
    In v16 and before, that just requires adding the new ID at the end
    of the hand-assigned enum list, ignoring our convention about
    alphabetizing the IDs.  But in v17, genbki.pl enforces alphabetical
    order of the IDs listed in MAKE_SYSCACHE macros.  We can fake it
    out by calling the new cache ZEXTENSIONOID.
    
    Note that adding a syscache does change the required contents of the
    relcache init file (pg_internal.init).  But that isn't problematic
    since we blow those away at postmaster start for other reasons.
    
    Author: Tom Lane <[email protected]>
    Reviewed-by: Noah Misch <[email protected]>
    Security: CVE-2026-2004
    Backpatch-through: 14-17
---
 src/backend/utils/cache/syscache.c | 8 ++++++++
 src/include/utils/syscache.h       | 5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/cache/syscache.c 
b/src/backend/utils/cache/syscache.c
index 65c20bde39e..a8901a957eb 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -43,6 +43,7 @@
 #include "catalog/pg_directory_table.h"
 #include "catalog/pg_enum.h"
 #include "catalog/pg_event_trigger.h"
+#include "catalog/pg_extension.h"
 #include "catalog/pg_foreign_data_wrapper.h"
 #include "catalog/pg_foreign_server.h"
 #include "catalog/pg_foreign_table.h"
@@ -823,6 +824,13 @@ static const struct cachedesc cacheinfo[] = {
                        0
                },
                128
+       },
+       /* intentionally out of alphabetical order, to avoid an ABI break: */
+       [EXTENSIONOID] = {
+               ExtensionRelationId,
+               ExtensionOidIndexId,
+               KEY(Anum_pg_extension_oid),
+               2
        }
 };
 
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index b0658a94bd9..1d033c664a7 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -134,7 +134,10 @@ enum SysCacheIdentifier
        USERMAPPINGUSERSERVER,
        ATTENCODINGNUM
 
-#define SysCacheSize (ATTENCODINGNUM + 1)
+       /* intentionally out of alphabetical order, to avoid an ABI break: */
+       EXTENSIONOID
+
+#define SysCacheSize (EXTENSIONOID + 1)
 };
 
 extern void InitCatalogCache(void);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to