ALTER_RULE(7pg16)

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

πŸ’… ALTER RULE (7) β€” the glow-up page for your rules

ok so bestie, welcome to the <pink>PostgreSQL 16.15</pink> corner of the manual that's literally just about renaming rules. That's it. That's the whole vibe. It's short, it's sweet, it's giving "micro-manpage" energy and honestly? We love a concise icon. ✨


✨ NAME ✨

ALTER_RULE β€” change the definition of a rule πŸŽ€


🌸 SYNOPSIS 🌸

ALTER RULE name ON table_name RENAME TO new_name

That's the one and only shape this command comes in, no cap.


πŸ’– DESCRIPTION πŸ’–

So here's the tea: ALTER RULE changes properties of an existing rule. And when I say "properties," I mean... okay don't get too excited, because right now the only available action is changing the rule's name. That's the entire menu. One item. A solo act. Main character energy, honestly. πŸ‘‘

But real talk before you go renaming things: to use ALTER RULE, you must own the table or view that the rule applies to. Not vibes-based ownership, actual ownership. If it's not yours, the answer is no. πŸ™ˆ


πŸ¦‹ PARAMETERS πŸ¦‹

  • name β€” the name of an existing rule you wanna alter. Gotta be a rule that's already out here existing, bestie.
  • table_name β€” the name (optionally schema-qualified) of the table or view that the rule applies to. Yes, optional schema qualification is allowed, we're fancy like that. πŸ’…
  • new_name β€” the new name for the rule. The fresh identity. The rebrand. πŸ¦‹

⭐ EXAMPLES ⭐

Wanna rename an existing rule? Say less. Here's the whole move:

ALTER RULE notify_all ON emp RENAME TO notify_me;

Look at that. notify_all walked in, notify_me walked out. Iconic. πŸ”₯


🌈 COMPATIBILITY 🌈

ALTER RULE is a <purple>PostgreSQL language extension</purple> β€” and ngl, so is the entire query rewrite system. So if you're out here expecting this to be standard SQL... it's not, and that's just how it is, fr fr. 🫢


πŸŽ€ SEE ALSO πŸŽ€


okay that's genuinely the whole page, no filler, no extra lore πŸ’€ if you came here looking for forty options you're in the wrong manpage, bestie β€” this one's a one-trick pony and she's slaying at it πŸ’œ

PostgreSQL 16.15 Β· <lavender>2026</lavender> Β· ALTER RULE(7) β€” mwah, go forth and rename responsibly, iykyk πŸŒΈπŸ§šπŸ’–

πŸ“¦ where this page comes from