ALTER SCHEMA

更新时间:
复制 MD 格式

Renames a schema in a Hologres database.

Syntax

ALTER SCHEMA <old_schema_name> RENAME TO <new_schema_name>;

Parameters

ParameterDescription
old_schema_nameThe current name of the schema to rename.
new_schema_nameThe new name for the schema.

Limits

Only the schema name can be changed. Other schema attributes are not modifiable.

Example

Rename my_schema to new_schema:

ALTER SCHEMA my_schema RENAME TO new_schema;

To switch the current session to the renamed schema, run SET search_path separately:

SET search_path TO new_schema;
SET search_path is a separate command that updates the default schema for the current session. It is not part of the ALTER SCHEMA statement.