Is it possible to dump then recreate with proper table analysis, so for example if table A depends on table B, then table B will be dumped first, then the table A
something like
CREATE TABLE B(...);
COPY ... TO B;
CREATE TABLE A(...);
COPY ... TO A;
ALTER TABLE A ADD FOREIGN KEY ... REFERENCES B(...);
CREATE INDEX ON A ....;
I'm trying to dump from one database to another database directly:
pg_dump -U user1 -h db1.rds.amazonaws.com db1 |
pv |
psql -U user2 -h localhost -p 15432 db2