You can execute the ALTER SCHEMA statement to modify a schema in a database. This topic describes how to use the ALTER SCHEMA statement and the limits on using the statement.
- You can change only the name of a schema.
- After you execute the
ALTER SCHEMA RENAMEstatement, all tables in the schema with the original name are moved to the schema with the new name. The schema with the original name still exists.
ALTER SCHEMA oldschema RENAME TO newschema;
ALTER SCHEMA my_schema RENAME TO new_schema; SET search_path TO my_schema; // Go to the schema with the original name. SET search_path TO new_schema; // Go to the schema with the new name.