Thread: Copying few tables from one database to another

Copying few tables from one database to another

From
Alexander Farber
Date:
Hello,

what is please the command to copy tables from 1 database
from another and is it possible at all without using pg_dump?

I'm trying to migrate 4700 users from phpBB 3 to Drupal 7
and have few custom tables in the "phpbb" database
which need to be copied over.

Using CentOS 5.5/64 bit + PostgreSQL 8.4.7

Thank you for the hints into the right direction
Alex

Re: Copying few tables from one database to another

From
Vibhor Kumar
Date:
On Mar 6, 2011, at 7:13 PM, Alexander Farber wrote:

> what is please the command to copy tables from 1 database
> from another and is it possible at all without using pg_dump?



You can create Structure of table in New database and then you can use COPY Command to copy data as given below:
psql -c 'COPY tablename to STDOUT;' dbname|psql -c 'COPY tablename from STDIN;' dbname


Thanks & Regards,
Vibhor Kumar
EnterpriseDB Corporation
The Enterprise PostgreSQL Company
vibhor.kumar@enterprisedb.com
Blog:http://vibhork.blogspot.com