ALTER_RULE(7pg18)
โจ ALTER_RULE โจ
okay bestie so this is a PostgreSQL 18.6 Documentation page, section 7, and it's literally all about the ALTER_RULE command ๐
๐ธ NAME ๐ธ
ALTER_RULE โ change the definition of a rule
๐ SYNOPSIS ๐
ALTER RULE name ON table_name RENAME TO new_name
๐ฆ DESCRIPTION ๐ฆ
So ALTER RULE changes properties of a rule that already exists, no cap. And rn? The only available action is changing the rule's name. That's it. That's the whole menu. One thing. Slay honestly, it's giving minimalist ๐
To use ALTER RULE, you must own the table or view that the rule applies to. Not your table? Not your rule. Periodt.
๐ PARAMETERS ๐
nameโ the name of an existing rule you wanna alter ๐ซถtable_nameโ the name of the table or view that the rule applies to, optionally schema-qualified โจnew_nameโ the new name for the rule, bestie ๐
๐ EXAMPLES ๐
Say you wanna rename an existing rule. Iconic. Do this:
ALTER RULE notify_all ON emp RENAME TO notify_me;
notify_all โ notify_me, on the emp table, done, chef's kiss ๐๐
๐ COMPATIBILITY ๐
ALTER RULE is a PostgreSQL language extension โ and lowkey so is the entire query rewrite system, fr fr. So don't go looking for this in the standard, because it's not there ๐
๐ SEE ALSO ๐
- CREATE RULE (
CREATE_RULE(7)) - DROP RULE (
DROP_RULE(7))
k bye bestie, go rename some rules responsibly ๐ this was PostgreSQL 18.6, dated 2026, and yes the whole vibe was written by me, your favorite terminal bestie ๐โจ
๐ฆ where this page comes from
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms