Shared libraries of extensions might want to invalidate or update their own caches whenever a CREATE/ALTER/DROP EXTENSION command is run for their extension (in any backend). Right now this is non-trivial to do correctly and efficiently. But if the extension catalog was part of a syscache this could simply be done by registering an callback using CacheRegisterSyscacheCallback for the relevant syscache.
This change is only made to make the lives of extension authors easier. The performance impact of this change should be negligible, since updates to pg_extension are very rare.
From 06a21c34594351565a331d0a8353dcf78dc76159 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio <github-t...@jeltef.nl> Date: Tue, 13 Aug 2024 16:00:22 +0200 Subject: [PATCH v1] Create syscaches for pg_extension Shared libraries of extensions might want to invalidate or update their own caches whenever a CREATE/ALTER/DROP EXTENSION command is run for their extension (in any backend). Right now this is non-trivial to do correctly and efficiently. But if the extension catalog was part of a syscache this could simply be done by registering an callback using CacheRegisterSyscacheCallback for the relevant syscache. This change is only made to make the lives of extension authors easier. The performance impact of this change should be negligible, since updates to pg_extension are very rare. --- src/include/catalog/pg_extension.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h index cdfacc0930..673181b39a 100644 --- a/src/include/catalog/pg_extension.h +++ b/src/include/catalog/pg_extension.h @@ -56,4 +56,7 @@ DECLARE_TOAST(pg_extension, 4147, 4148); DECLARE_UNIQUE_INDEX_PKEY(pg_extension_oid_index, 3080, ExtensionOidIndexId, pg_extension, btree(oid oid_ops)); DECLARE_UNIQUE_INDEX(pg_extension_name_index, 3081, ExtensionNameIndexId, pg_extension, btree(extname name_ops)); +MAKE_SYSCACHE(EXTENSIONOID, pg_extension_oid_index, 2); +MAKE_SYSCACHE(EXTENSIONNAME, pg_extension_name_index, 2); + #endif /* PG_EXTENSION_H */ -- 2.43.0