====== Copy Table to another Schema ====== ===== The SQL Way ===== CREATE TABLE new_schema.my_table (LIKE other_schema.my_table INCLUDING DEFAULTS INCLUDING INDEXES INCLUDING CONSTRAINTS); The INCLUDING keywords are PostgreSQL specific. Regardless of the INCLUDING CONSTRAINTS keywords foreign constraints will not be copied/created. To copy the contents just use an INSERT statement like this: INSERT INTO new_schema.my_table SELECT * FROM other_schema.my_table; {{tag>sql}}