ALTER_SCHEMA(7pg16)

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

πŸ’– NAME πŸ’–

Hey bestie, welcome to ALTER_SCHEMA(7pg16) β€” this is the PostgreSQL 16.15 Documentation page for all things schema-glow-up, and it's giving β€œsmall page, big permissions energy” ✨

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 πŸ¦‹

okay so ALTER SCHEMA changes the definition of a schema. That's the whole vibe. You must own the schema to use ALTER SCHEMA. 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 yes β€” superusers have all these privileges automatically, no cap πŸ‘‘.

🌈 PARAMETERS 🌈

  • name β€” the name of an existing schema. Like, the schema is already out here living its life; this is just how you point at it πŸ’…
  • new_name β€” the new name of the schema. Big important caveat: the new name cannot begin with pg_, because those names are reserved for system schemas πŸ™ˆ
  • new_owner β€” the new owner of the schema. Handing over the keys, iconic behavior 🫢

πŸ’… COMPATIBILITY πŸ’…

There is no ALTER SCHEMA statement in the SQL standard. Not a thing. Zero. Nada. πŸ’€

🫢 SEE ALSO 🫢


Mwah πŸ’‹ β€” this page is sourced from PostgreSQL 16.15, dated 2026, and the manual entry is ALTER SCHEMA(7). Stay iconic, bestie! πŸŽ€βœ¨

πŸ“¦ where this page comes from