ALTER_SCHEMA(7)

💖 ALTER SCHEMA — bestie edition 💖

okay so this is the ALTER SCHEMA(7) page from the PostgreSQL 18.6 Documentation, and we're gonna make it make sense together, no cap. it's giving "glow-up for your schemas" energy and honestly? obsessed. 🎀


✨ NAME ✨

ALTER_SCHEMA — change the definition of a schema 🦋


✨ SYNOPSIS ✨

ALTER SCHEMA name RENAME TO new_name
ALTER SCHEMA name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }

✨ DESCRIPTION ✨

so like. ALTER SCHEMA changes the definition of a schema. that's the whole vibe. two things you can do: rename it, or hand it to a new owner. 💅

now here's the part where you actually need permission, bestie, and she does not play:

  • You must own the schema to use ALTER SCHEMA. like, it has to be yours. 🔑
  • To rename a schema you must also have the CREATE privilege for the database.
  • To alter the owner, you must be able to SET ROLE to the new owning role, and that role must have the CREATE privilege for the database.
and just so we're clear — superusers have all these privileges automatically. main character energy, no questions asked. 👑

✨ PARAMETERS ✨

  • name — the name of an existing schema. the one you're messing with. 🫶
  • new_name — the new name of the schema. ⚠️ the new name cannot begin with pg_, because those names are reserved for system schemas. do not touch. that's not your lane, that's the system's lane. 🚫
  • new_owner — the new owner of the schema. handing over the keys, basically. 🗝️

✨ COMPATIBILITY ✨

ngl there is no ALTER SCHEMA statement in the SQL standard. it's just not a thing there. we made it, we love it, it's ours. 💀


✨ SEE ALSO ✨


and that's the whole page, bestie!! you ate. 💖✨

PostgreSQL 18.6 · 2026 · ALTER SCHEMA(7) — mwah, go rename something responsibly 🎀🌈🦋