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
CREATEprivilege for the database. - To alter the owner, you must be able to
SET ROLEto the new owning role, and that role must have theCREATEprivilege 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 withpg_, 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 ✨
CREATE SCHEMA(CREATE_SCHEMA(7)) 🌱DROP SCHEMA(DROP_SCHEMA(7)) 💥
and that's the whole page, bestie!! you ate. 💖✨
PostgreSQL 18.6 · 2026 · ALTER SCHEMA(7) — mwah, go rename something responsibly 🎀🌈🦋
📦 where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 · PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 · PostgreSQL
- arch rolling: postgresql 18.6-4 · PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 · PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 · PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 · PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 · PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 · PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 · PostgreSQL
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms