↑↓ 选择 ↵ 打开 ⌫ 改范围 完整检索页

pgsql.cc 提供对 postgresql.org 官网内容的中文翻译,由 Pigsty 团队维护。

百科 / 扩展钩子 / 权限与对象访问

row_security_policy_hook_permissive

宽松行安全策略

这些钩子允许扩展添加自己的安全策略。row_security_policy_hook_permissive 添加的策略通过 OR 与其他宽松策略组合;row_security_policy_hook_restrictive 添加的策略始终必须满足,通过 AND 与其他策略组合。

当前查看 PostgreSQL 18。

中文定义与说明

这些钩子允许扩展添加自己的安全策略。row_security_policy_hook_permissive 添加的策略通过 OR 与其他宽松策略组合;row_security_policy_hook_restrictive 添加的策略始终必须满足,通过 AND 与其他策略组合。

以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。

接口声明

typedef List *(*row_security_policy_hook_type) (CmdType cmdtype, Relation relation);
extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive;

调用位置

  • src/backend/rewrite/rowsecurity.c:644

核心调用上下文:src/backend/rewrite/rowsecurity.c:638–652

		}
	}

	if (row_security_policy_hook_permissive)
	{
		List	   *hook_policies =
			(*row_security_policy_hook_permissive) (cmd, relation);

		foreach(item, hook_policies)
		{
			RowSecurityPolicy *policy = (RowSecurityPolicy *) lfirst(item);

			if (check_role_for_policy(policy->roles, user_id))
				*permissive_policies = lappend(*permissive_policies, policy);
		}

说明

这些钩子允许扩展添加自己的安全策略。row_security_policy_hook_permissive 添加的策略通过 OR 与其他宽松策略组合;row_security_policy_hook_restrictive 添加的策略始终必须满足,通过 AND 与其他策略组合。

接口类型
row_security_policy_hook_type
声明头文件
src/include/rewrite/rowsecurity.h
调用阶段
权限与对象访问
初始值
NULL(未安装钩子)

接口签名

typedef List *(*row_security_policy_hook_type) (CmdType cmdtype, Relation relation);
extern PGDLLIMPORT row_security_policy_hook_type row_security_policy_hook_permissive;

调用位置

src/backend/rewrite/rowsecurity.c:644

相关条目

文档与源码

查看来源构建
版本
18
构建
REL_18_STABLE
来源指纹
753057e340da8f22e57c9a409ea7a235fd6a46bd

同类条目

返回扩展钩子 · 此条目的收录范围为 PostgreSQL 10 至 20;起点不一定是实际引入版本。