跳转到主要内容
← 目录图谱 / pg_policy

SYSTEM CATALOG · 系统目录

pg_policy

The catalog pg_policy stores row-level security policies for tables. A policy includes the kind of command that it applies to (possibly all commands), the roles that it applies to, the expression to be added as a security-barrier qualification to queries that include the table, and the expression to be added as a WITH CHECK option for queries that attempt to add new records to the table.

首次收录 PG 9.5最近收录 PG 19当前字段 8

已与 PostgreSQL 18.6 实例逐字段核对 · 原始实测记录 ↗

字段结构 PostgreSQL 18

pg_policy
字段 / COLUMN类型 / TYPE说明 / DESCRIPTION
oid oidNOT NULL Row identifier
polname nameNOT NULL The name of the policy
polrelid oidNOT NULL The table to which the policy applies引用:pg_class.oid
polcmd "char"NOT NULL文档原写法:char The command type to which the policy is applied: r for SELECT, a for INSERT, w for UPDATE, d for DELETE, or * for all
polpermissive booleanNOT NULL文档原写法:bool Is the policy permissive or restrictive?
polroles oid[]NOT NULL The roles to which the policy is applied; zero means PUBLIC (and normally appears alone in the array)引用:pg_authid.oid
polqual pg_node_tree The expression tree to be added to the security barrier qualifications for queries that use the table
polwithcheck pg_node_tree The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table

标记“隐式列”的字段不包含在 SELECT * 中;部分早期统计视图由同版本源码补全,额外来源会显示在字段说明中。

通用系统列 6

PostgreSQL 提供的系统属性,通常不在 SELECT * 中展开。单独保留,不与普通字段混算。

字段类型attnum
tableoidoid-6
cmaxcid-5
xmaxxid-4
cmincid-3
xminxid-2
ctidtid-1

字段演化矩阵

悬停查看字段类型
存在新增 / 类型或属性变化移除
字段 / COLUMN9.09.19.29.39.49.59.610111213141516171819
oid
polname
polrelid
polcmd
polroles
polqual
polwithcheck
polpermissive

9.0 是收录基线;基线中已存在的字段不标记为新增。矩阵按字段名称对齐,重命名显示为旧字段移除与新字段新增。

演化时间线

相邻大版本的变化

PostgreSQL 14 ← 13

1 处字段说明更新目录说明更新

PostgreSQL 13 ← 12

1 处字段说明更新

PostgreSQL 12 ← 11

~ oid: 隐式列 → 常规列~ polroles: not_null: false → true1 处字段说明更新

PostgreSQL 10 ← 9.6

+ polpermissive

PostgreSQL 9.5 ← 9.4新增目录

+ oid+ polname+ polrelid+ polcmd+ polroles+ polqual+ polwithcheck

比较任意两个版本

选择两个版本,查看字段的新增、移除与类型变化。交互比较需要 JavaScript;演化时间线可直接阅读。