I have a the same table in two databases within one postgres server.
I would like to know if it is possible to copy a table under schemaA in DB1 to schemaB in DB2. Or alternatively, copy the data from a table under schemaA in DB1 to the equivalent empty schemaB in DB2.
I have researched a found the pg_dump code to be effective, however I would need to rename the schema to the destination schema before executing...
pg_dump -t schemaAt.table 'DB1' | psql 'DB2'
I am also wondering if 'pg_restore' command can be used to to restore the data only into a new schema?
Any help would be much appreciated
Thanks
db2.schemab.tableto point todb1.schemaa.tablethen you don't need to copy anything. Or merge both databases into one.