May 2019
Intermediate to advanced
600 pages
20h 46m
English
To move one table from its current schema to a new schema, use the following:
ALTER TABLE custSET SCHEMA anotherschema;
If you want to move all objects, you can consider renaming the schema itself by using the following query:
ALTER SCHEMA existingschema RENAME TO anotherschema;
This only works if another schema with that name does not exist. Otherwise, you'll need to run ALTER TABLE for each table you want to move. You can use the earlier recipe in this chapter Performing actions on many tables, to achieve that.
Views, sequences, functions, aggregates, and domains can also be moved by ALTER commands with SET SCHEMA options.
Read now
Unlock full access