RENAME SCHEMA

Renaming schemas is mainly used for improving the clarity and organization of a database by giving schemas more meaningful or concise names.

Warning

Renaming a schema can void existing views that use this schema. See more about recompiling views.

Permissions

The role must have the DDL permission on the schema being renamed.

Syntax

alter_schema_rename_schema_statement ::=
    ALTER SCHEMA [database_name.]current_name RENAME TO new_name
    ;

current_name ::= identifier

database_name ::= identifier

new_name ::= identifier

Parameters

Parameter

Description

database_name

The database containing the schema. Defaults to the current database if not specified.

current_name

The schema name to apply the change to.

new_name

The new schema name.

Examples

ALTER SCHEMA master.staging RENAME TO staging_new;