pg_rewrite

The pg_rewrite catalog provides information about rewrite rules for tables and views.

Column name Data type Description
oid oid A row identifier.
rulename name The name of the rule.
ev_class oid (references pg_class.oid) The table to which the rule applies.
ev_type char The event type to which the rule applies.
The possible values are:
  • 1 – SELECT.
  • 2 – UPDATE.
  • 3 – INSERT.
  • 4 – DELETE.
ev_enabled char Controls the session_replication_role modes in which the rule is activated.
The possible values are:
  • O – The rule fires in “origin” and “local” modes.
  • D – The rule is disabled.
  • R – The rule fires in the “replica” mode.
  • A – The rule always fires.
is_instead bool Specifies whether it is an INSTEAD rule (TRUE) or not (FALSE).
ev_qual pg_node_tree The expression tree, represented in the nodeToString() form, that defines the rule’s qualifying condition.
ev_action pg_node_tree The query tree, represented in the nodeToString() form, that defines the rule’s action.