ALTER_SCHEMA(7pg16)
π 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 withpg_, 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 π«Ά
CREATE SCHEMA(CREATE_SCHEMA(7))DROP SCHEMA(DROP_SCHEMA(7))
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
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms