pg_rewrite 是一个 系统目录 表,包含表和视图的重写规则。
pg_rewrite 在所有 PostgreSQL 版本中都存在。
用法
pg_rewrite 仅供内部使用。请使用视图 pg_rules 来获取 pg_rewrite 内容的可读版本。
按 PostgreSQL 版本定义
pg_rewrite (PostgreSQL 19)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
oid | oid | | not null |
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | C | not null |
ev_action | pg_node_tree | C | not null |
Indexes:
"pg_rewrite_oid_index" PRIMARY KEY, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE CONSTRAINT, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 18)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
oid | oid | | not null |
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | C | not null |
ev_action | pg_node_tree | C | not null |
Indexes:
"pg_rewrite_oid_index" PRIMARY KEY, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE CONSTRAINT, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 17)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
oid | oid | | not null |
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | C | not null |
ev_action | pg_node_tree | C | not null |
Indexes:
"pg_rewrite_oid_index" PRIMARY KEY, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE CONSTRAINT, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 16)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
oid | oid | | not null |
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | C | not null |
ev_action | pg_node_tree | C | not null |
Indexes:
"pg_rewrite_oid_index" PRIMARY KEY, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE CONSTRAINT, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 15)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
oid | oid | | not null |
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | C | not null |
ev_action | pg_node_tree | C | not null |
Indexes:
"pg_rewrite_oid_index" PRIMARY KEY, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE CONSTRAINT, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 14)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
oid | oid | | not null |
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | C | not null |
ev_action | pg_node_tree | C | not null |
Indexes:
"pg_rewrite_oid_index" PRIMARY KEY, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE CONSTRAINT, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 13)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
oid | oid | | not null |
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | C | not null |
ev_action | pg_node_tree | C | not null |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 12)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
oid | oid | | not null |
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | C | not null |
ev_action | pg_node_tree | C | not null |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 11)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | | |
ev_action | pg_node_tree | | |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 10)
Table "pg_catalog.pg_rewrite"
Column | Type | Collation | Nullable | Default
------------+--------------+-----------+----------+---------
rulename | name | | not null |
ev_class | oid | | not null |
ev_type | "char" | | not null |
ev_enabled | "char" | | not null |
is_instead | boolean | | not null |
ev_qual | pg_node_tree | | |
ev_action | pg_node_tree | | |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 9.6)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+--------------+-----------
rulename | name | not null
ev_class | oid | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | pg_node_tree |
ev_action | pg_node_tree |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 9.5)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+--------------+-----------
rulename | name | not null
ev_class | oid | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | pg_node_tree |
ev_action | pg_node_tree |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 9.4)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+--------------+-----------
rulename | name | not null
ev_class | oid | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | pg_node_tree |
ev_action | pg_node_tree |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 9.3)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+--------------+-----------
rulename | name | not null
ev_class | oid | not null
ev_attr | smallint | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | pg_node_tree |
ev_action | pg_node_tree |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 9.2)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+--------------+-----------
rulename | name | not null
ev_class | oid | not null
ev_attr | smallint | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | pg_node_tree |
ev_action | pg_node_tree |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 9.1)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+--------------+-----------
rulename | name | not null
ev_class | oid | not null
ev_attr | smallint | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | pg_node_tree |
ev_action | pg_node_tree |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 9.0)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+----------+-----------
rulename | name | not null
ev_class | oid | not null
ev_attr | smallint | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | text |
ev_action | text |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 8.4)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+----------+-----------
rulename | name | not null
ev_class | oid | not null
ev_attr | smallint | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | text |
ev_action | text |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 8.3)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+----------+-----------
rulename | name | not null
ev_class | oid | not null
ev_attr | smallint | not null
ev_type | "char" | not null
ev_enabled | "char" | not null
is_instead | boolean | not null
ev_qual | text |
ev_action | text |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
pg_rewrite (PostgreSQL 8.2)
Table "pg_catalog.pg_rewrite"
Column | Type | Modifiers
------------+----------+-----------
rulename | name | not null
ev_class | oid | not null
ev_attr | smallint | not null
ev_type | "char" | not null
is_instead | boolean | not null
ev_qual | text |
ev_action | text |
Indexes:
"pg_rewrite_oid_index" UNIQUE, btree (oid)
"pg_rewrite_rel_rulename_index" UNIQUE, btree (ev_class, rulename)
文档: pg_rewrite
变更历史
注意:列表不包含 PostgreSQL 8.2 之前的任何更改。
- PostgreSQL 9.4
- 列
ev_attr已删除 (commit 277607d6)
- 列
- PostgreSQL 9.1
- 列
ev_qual已更改为pg_node_tree类型 (commit 303696c3) - 列
ev_action已更改为pg_node_tree类型 (commit 303696c3)
- 列
- PostgreSQL 8.3
- 列
ev_enabled已添加 (commit 0fe16500)
- 列
参考资料
- PostgreSQL 文档: pg_rewrite
