pg_policy 是一个 系统目录 表,用于存储表的行级安全 (RLS) 策略。
pg_policy 添加于 PostgreSQL 9.5。
按 PostgreSQL 版本定义
pg_policy (PostgreSQL 19)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | not null |
polqual | pg_node_tree | C | |
polwithcheck | pg_node_tree | C | |
Indexes:
"pg_policy_oid_index" PRIMARY KEY, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE CONSTRAINT, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 18)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | not null |
polqual | pg_node_tree | C | |
polwithcheck | pg_node_tree | C | |
Indexes:
"pg_policy_oid_index" PRIMARY KEY, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE CONSTRAINT, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 17)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | not null |
polqual | pg_node_tree | C | |
polwithcheck | pg_node_tree | C | |
Indexes:
"pg_policy_oid_index" PRIMARY KEY, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE CONSTRAINT, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 16)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | not null |
polqual | pg_node_tree | C | |
polwithcheck | pg_node_tree | C | |
Indexes:
"pg_policy_oid_index" PRIMARY KEY, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE CONSTRAINT, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 15)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | not null |
polqual | pg_node_tree | C | |
polwithcheck | pg_node_tree | C | |
Indexes:
"pg_policy_oid_index" PRIMARY KEY, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE CONSTRAINT, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 14)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | not null |
polqual | pg_node_tree | C | |
polwithcheck | pg_node_tree | C | |
Indexes:
"pg_policy_oid_index" PRIMARY KEY, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE CONSTRAINT, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 13)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | not null |
polqual | pg_node_tree | C | |
polwithcheck | pg_node_tree | C | |
Indexes:
"pg_policy_oid_index" UNIQUE, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 12)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
oid | oid | | not null |
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | not null |
polqual | pg_node_tree | C | |
polwithcheck | pg_node_tree | C | |
Indexes:
"pg_policy_oid_index" UNIQUE, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 11)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | |
polqual | pg_node_tree | | |
polwithcheck | pg_node_tree | | |
Indexes:
"pg_policy_oid_index" UNIQUE, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 10)
Table "pg_catalog.pg_policy"
Column | Type | Collation | Nullable | Default
---------------+--------------+-----------+----------+---------
polname | name | | not null |
polrelid | oid | | not null |
polcmd | "char" | | not null |
polpermissive | boolean | | not null |
polroles | oid[] | | |
polqual | pg_node_tree | | |
polwithcheck | pg_node_tree | | |
Indexes:
"pg_policy_oid_index" UNIQUE, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 9.6)
Table "pg_catalog.pg_policy"
Column | Type | Modifiers
--------------+--------------+-----------
polname | name | not null
polrelid | oid | not null
polcmd | "char" | not null
polroles | oid[] |
polqual | pg_node_tree |
polwithcheck | pg_node_tree |
Indexes:
"pg_policy_oid_index" UNIQUE, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE, btree (polrelid, polname)
文档: pg_policy
pg_policy (PostgreSQL 9.5)
Table "pg_catalog.pg_policy"
Column | Type | Modifiers
--------------+--------------+-----------
polname | name | not null
polrelid | oid | not null
polcmd | "char" | not null
polroles | oid[] |
polqual | pg_node_tree |
polwithcheck | pg_node_tree |
Indexes:
"pg_policy_oid_index" UNIQUE, btree (oid)
"pg_policy_polrelid_polname_index" UNIQUE, btree (polrelid, polname)
文档: pg_policy
变更历史
- PostgreSQL 10
- 列
polpermissive已添加 (提交 093129c9)
- 列
- PostgreSQL 9.5
参考资料
- PostgreSQL 文档: pg_policy
另请参阅
pg_policies, 行级安全
