## 52.43. `pg_rewrite`

[]()

 The catalog `pg_rewrite` stores rewrite rules for tables and views.

**Table 52.43. `pg_rewrite` Columns**

|                                                                                                                                Column Type<br/><br/> Description                                                                                                                               |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|                                                                                                                              `oid` `oid`<br/><br/> Row identifier                                                                                                                              |
|                                                                                                                             `rulename` `name`<br/><br/> Rule name                                                                                                                              |
|                                                                                          `ev_class` `oid` (references [`pg_class`](catalog-pg-class.html).`oid`)<br/><br/> The table this rule is for                                                                                          |
|                                                     `ev_type` `char`<br/><br/> Event type that the rule is for: 1 = [SELECT](sql-select.html), 2 = [UPDATE](sql-update.html), 3 = [INSERT](sql-insert.html), 4 = [DELETE](sql-delete.html)                                                     |
|`ev_enabled` `char`<br/><br/> Controls in which [session\_replication\_role](runtime-config-client.html#GUC-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_instead` `bool`<br/><br/> True if the rule is an `INSTEAD` rule                                                                                                               |
|                                                                           `ev_qual` `pg_node_tree`<br/><br/> Expression tree (in the form of a `nodeToString()` representation) for the rule's qualifying condition                                                                            |
|                                                                                    `ev_action` `pg_node_tree`<br/><br/> Query tree (in the form of a `nodeToString()` representation) for the rule's action                                                                                    |

### Note

`pg_class.relhasrules` must be true if a table has any rules in this catalog.

