52.43. pg\_rewrite

|           52.43. `pg_rewrite`            |                   |                           |                  |                                 |
|:----------------------------------------:|-------------------|---------------------------|------------------|---------------------------------|
|[Prev](catalog-pg-replication-origin.html)|[Up](catalogs.html)|Chapter 52. System Catalogs|[Home](index.html)| [Next](catalog-pg-seclabel.html)|

---

## 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.

---

|[Prev](catalog-pg-replication-origin.html)|[Up](catalogs.html)| [Next](catalog-pg-seclabel.html)|
|:-----------------------------------------|:-----------------:|--------------------------------:|
|      52.42. `pg_replication_origin`      |[Home](index.html) |       52.44. `pg_seclabel`      |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>