How to import data from a dump file to a specific schema in postgres? Let us assume there's a database name myDataBase. There are four schema in this database named

1: schema_1

2: schema_2

3: schema_3

4: schema_4

I have created a dump of schema_1 from this command pg_dump  myDataBase --schema=schema_1 &gt; schema_1_dump 

How to import schema_1_dump to only schema_3 but not to any other schema
probably the easiest is to first rename the existing schema_1

restore the dump

rename the new schema_1 to schema_3

restore the original schema_1 to its original name

eg psql:

 alter schema schema_1 rename to schema_1_backup;
 create schema schema_1;
 \i schema_1_dump
 drop schema_3 cascade;
 alter schema schema_1 rename to schema_3;
 alter schema schema_1_backup rename to schema_1;


This is going to annoy other users.

The other way is to change all the SQL commands to say  'schema3' instead of 'schema1'