Move Tables From One Database to Another

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Move Tables From One Database to Another
Date: 2012-03-29 19:10:12
Message-ID: alpine.LNX.2.00.1203291206550.7215@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm storing vector map attribute data in postgres tables and somehow
managed to create two databases (of similar names) rather than one. I want
to combine the two.

For tables that exist in the one database I want to eliminate, I thought
to use pg_dump to create .sql files, then use pg_restore to add the table to
the other database. Did this for one table (with 4201 rows), but 'pg_restore
-d database_name -t table_name' appears to not complete; it seems to have
hung up somewhere. While I see nothing specific in the output file or the
pg_restore man page this must not be the proper approach.

Also, I need suggestions on how to combine tables that exist in both
databases by adding rows from the source database not in the target database
and modifying rows that differ.

As I'm not a professional or full-time DBA I'm probably missing really
simple syntax and approaches. Your advice will be appreciated.

Rich

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gabriele Bartolini 2012-03-29 19:39:12 Re: Move Tables From One Database to Another
Previous Message Tom Molesworth 2012-03-29 18:26:51 Re: Managing two sets of data in one database