From f3f1eb39a52c724512c4b50634404b074acd900a Mon Sep 17 00:00:00 2001 From: Harsh Lunagariya Date: Sun, 8 Dec 2024 15:06:31 +0000 Subject: [PATCH] Add hook Signed-off-by: Harsh Lunagariya --- src/backend/catalog/aclchk.c | 5 ++++- src/include/utils/acl.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/catalog/aclchk.c b/src/backend/catalog/aclchk.c index 3d1453c1311..60db591277f 100644 --- a/src/backend/catalog/aclchk.c +++ b/src/backend/catalog/aclchk.c @@ -171,7 +171,7 @@ static void recordExtensionInitPrivWorker(Oid objoid, Oid classoid, int objsubid tsql_has_linked_srv_permissions_hook_type tsql_has_linked_srv_permissions_hook = NULL; bbf_execute_grantstmt_as_dbsecadmin_hook_type bbf_execute_grantstmt_as_dbsecadmin_hook = NULL; - +pltsql_check_store_init_privs_flag_hook_type pltsql_check_store_init_privs_flag_hook = NULL; /* * If is_grant is true, adds the given privileges for the list of * grantees to the existing old_acl. If is_grant is false, the @@ -4687,6 +4687,9 @@ recordExtensionInitPriv(Oid objoid, Oid classoid, int objsubid, Acl *new_acl) if (!creating_extension && !binary_upgrade_record_init_privs) return; + if (!pltsql_check_store_init_privs_flag_hook || !((*pltsql_check_store_init_privs_flag_hook)())) + return; + recordExtensionInitPrivWorker(objoid, classoid, objsubid, new_acl); } diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h index c43cd5d90ba..109d1bbebff 100644 --- a/src/include/utils/acl.h +++ b/src/include/utils/acl.h @@ -306,6 +306,9 @@ extern PGDLLEXPORT pltsql_get_object_owner_hook_type pltsql_get_object_owner_hoo typedef bool (*is_bbf_db_ddladmin_operation_hook_type) (Oid namespaceId); extern PGDLLEXPORT is_bbf_db_ddladmin_operation_hook_type is_bbf_db_ddladmin_operation_hook; +typedef bool (*pltsql_check_store_init_privs_flag_hook_type) (void); +extern PGDLLEXPORT pltsql_check_store_init_privs_flag_hook_type pltsql_check_store_init_privs_flag_hook; + #define IS_BBF_DB_DDLADMIN(namespaceId) \ (is_bbf_db_ddladmin_operation_hook && \ is_bbf_db_ddladmin_operation_hook(namespaceId))