ALTER_RULE(7pg13)

πŸ“¦ version 13.23, in opensuse-leap 16.0

🌸 NAME 🌸

okay bestie, welcome to the ALTER_RULE(7pg13) page β€” ALTER_RULE is literally the command for change the definition of a rule. tiny name, real power, we love to see it πŸ’…


✨ SYNOPSIS ✨

ALTER RULE name ON table_name RENAME TO new_name

πŸ’– DESCRIPTION πŸ’–

So ALTER RULE changes properties of an existing rule. Currently, the only available action is to change the rule’s name β€” that’s the whole menu rn, no cap.

To use ALTER RULE, you must own the table or view that the rule applies to. like, it’s not giving β€œborrow your bestie’s rule and rename it,” okay? ownership check says hi πŸ™ˆ


πŸŽ€ PARAMETERS πŸŽ€

  • name β€” the name of an existing rule to alter. this is the rule you’re giving a glow-up / new identity ✨
  • table_name β€” the name (optionally schema-qualified) of the table or view that the rule applies to. yes, the table or view it belongs to, bestie πŸ’–
  • new_name β€” the new name for the rule. fresh name, same rule, iconic behavior πŸ‘‘

πŸ¦‹ EXAMPLES πŸ¦‹

To rename an existing rule:

ALTER RULE notify_all ON emp RENAME TO notify_me;

see? notify_all said β€œnot me anymore,” and now it’s notify_me. we’re obsessed 🫢


🌈 COMPATIBILITY 🌈

ALTER RULE is a PostgreSQL language extension, as is the entire query rewrite system. so yeah, this is very much a PostgreSQL-specific vibe β€” iykyk πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’– this lil page is from PostgreSQL 13.23 documentation, dated 2025 β€” now go forth and rename responsibly, bestie 🧚✨

πŸ“¦ where this page comes from