ALTER RULE
change the definition of a rule
English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- anchor
- SQL-ALTERRULE
- file
- sql-alterrule.html
- lang
- en
- name
- ALTER RULE
- purpose
- change the definition of a rule
- purpose zh
- 修改一条重写规则的定义
- sections same as
- Unknown
- slug
- 18
- synopsis html
- ALTER RULE <em class="replaceable"><code>name</code></em> ON <em class="replaceable"><code>table_name</code></em> RENAME TO <em class="replaceable"><code>new_name</code></em>
- synopsis text
- ALTER RULE name ON table_name RENAME TO new_name
Syntax
ALTER RULE name ON table_name RENAME TO new_nameSyntax diagrams
Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.
Definition PG 18
ALTER RULE name ON table_name RENAME TO new_name
Description
ALTER RULE changes properties of an existing rule. Currently, the only available action is to change the rule's name.
To use ALTER RULE, you must own the table or view that the rule applies to.
Parameters
nameThe name of an existing rule to alter.
table_nameThe name (optionally schema-qualified) of the table or view that the rule applies to.
new_nameThe new name for the rule.
Examples
To rename an existing rule:
ALTER RULE notify_all ON emp RENAME TO notify_me;
Compatibility
ALTER RULE is a PostgreSQL language extension, as is the entire query rewrite system.
See Also
CREATE RULE, DROP RULECompare versions
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:5308f09328bf0fed18b104dcc1921e37e4b8210b70bed8cf39426e7cf4fdb5a1
Text language: en · wiki-repair-20261023:5308f09328bf0fed18b104dcc1921e37e4b8210b70bed8cf39426e7cf4fdb5a1