↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / System Catalogs

pg_rewrite

The catalog pg_rewrite stores rewrite rules for tables and views.

English manual coverage begins with PostgreSQL 7.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

kind
catalog
lang
en
measured attributes
true
metadata release
18.6
runtime columns
oid, rulename, ev_class, ev_type, ev_enabled, is_instead, ev_qual, ev_action
runtime verified
false
source
english-manual

Definition PG 18

The catalog pg_rewrite stores rewrite rules for tables and views.

Catalog columns

ColumnTypeNullabilityDescription
oidoidNot nullRow identifier
rulenamenameNot nullRule name
ev_classoidNot nullThe table this rule is for
ev_typecharNot nullEvent type that the rule is for: 1 = SELECT, 2 = UPDATE, 3 = INSERT, 4 = DELETE
ev_enabledcharNot nullControls in which session_replication_role modes the rule fires. O = rule fires in “origin” and “local” modes, D = rule is disabled, R = rule fires in “replica” mode, A = rule fires always.
is_insteadboolNot nullTrue if the rule is an INSTEAD rule
ev_qualpg_node_treeNot nullExpression tree (in the form of a nodeToString() representation) for the rule's qualifying condition
ev_actionpg_node_treeNot nullQuery tree (in the form of a nodeToString() representation) for the rule's action

Compare versions

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · catalog-bilingual-repair:e7ccb909b3519dbb88e4822ddb088fcf39f96eee4b30d86491e19adcd850d18f

Text language: en · catalog-bilingual-repair:e7ccb909b3519dbb88e4822ddb088fcf39f96eee4b30d86491e19adcd850d18f