ALTER SCHEMA
change the definition of a schema
English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.
Reading PG 18·Select a recorded version
- anchor
- SQL-ALTERSCHEMA
- file
- sql-alterschema.html
- lang
- en
- name
- ALTER SCHEMA
- purpose
- change the definition of a schema
- purpose zh
- 更改一个模式的定义
- sections same as
- Unknown
- slug
- 18
- synopsis text
- ALTER SCHEMA name RENAME TO new_name ALTER SCHEMA name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
Syntax
ALTER SCHEMA name RENAME TO new_name
ALTER SCHEMA name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }Syntax diagrams
Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.
ALTER SCHEMA · Syntax 2
Definition PG 18
ALTER SCHEMA name RENAME TO new_name
ALTER SCHEMA name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }Description
ALTER SCHEMA changes the definition of a schema.
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. (Note that superusers have all these privileges automatically.)
Parameters
nameThe name of an existing schema.
new_nameThe new name of the schema. The new name cannot begin with
pg_, as such names are reserved for system schemas.new_ownerThe new owner of the schema.
Compatibility
There is no ALTER SCHEMA statement in the SQL standard.
See Also
CREATE SCHEMA, DROP SCHEMACompare versions
Complete source facts
synopsis html
ALTER SCHEMA <em class="replaceable"><code>name</code></em> RENAME TO <em class="replaceable"><code>new_name</code></em>
ALTER SCHEMA <em class="replaceable"><code>name</code></em> OWNER TO { <em class="replaceable"><code>new_owner</code></em> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:3cfa1fc0f9ba2cc85f625052cb4326ff418d307a84eafe938fb33c1157d02ac3
Text language: en · wiki-repair-20261023:3cfa1fc0f9ba2cc85f625052cb4326ff418d307a84eafe938fb33c1157d02ac3