Skip to content
← Catalog atlas / pg_policy

SYSTEM CATALOG · 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.

First seen PG 9.5Last seen PG 19Columns 8

Checked column by column against a PostgreSQL 18.6 instance · Raw measurement record ↗

Columns PostgreSQL 18

pg_policy
COLUMNTYPEDESCRIPTION
oid oidNOT NULL Row identifier
polname nameNOT NULL The name of the policy
polrelid oidNOT NULL The table to which the policy appliesReferences:pg_class.oid
polcmd "char"NOT NULLDocumented as: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 NULLDocumented as: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)References: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

Columns marked "implicit" are not included in SELECT *; some early statistics views are completed from same-version source, and the extra provenance is shown in the column description.

Common system columns 6

System attributes PostgreSQL provides, normally not expanded by SELECT *. Kept separately so they are not mixed in with ordinary columns.

ColumnsTypeattnum
tableoidoid-6
cmaxcid-5
xmaxxid-4
cmincid-3
xminxid-2
ctidtid-1

Column evolution matrix

Hover a cell for the column type
PresentAdded / type or attribute changeRemoved
COLUMN9.09.19.29.39.49.59.610111213141516171819
oid
polname
polrelid
polcmd
polroles
polqual
polwithcheck
polpermissive

9.0 is the coverage baseline; a column already present in the baseline is not marked as added. The matrix aligns columns by name, so a rename appears as the old column removed and a new column added.

Evolution timeline

Changes between adjacent majors

PostgreSQL 14 ← 13

1 column description updatesCatalog description updated

PostgreSQL 13 ← 12

1 column description updates

PostgreSQL 12 ← 11

~ oid: implicit → ordinary~ polroles: not_null: false → true1 column description updates

PostgreSQL 10 ← 9.6

+ polpermissive

PostgreSQL 9.5 ← 9.4Catalog added

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

Compare any two versions

Pick two versions to see added, removed, and retyped columns. The interactive comparison needs JavaScript; the evolution timeline reads fine without it.