ALTER_RULE(7)

โœจ 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 ๐Ÿ‘‘


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 ๐ŸŽ€โœจ