Re: Copying few tables from one database to another

From: Vibhor Kumar <vibhor(dot)kumar(at)enterprisedb(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Copying few tables from one database to another
Date: 2011-03-06 13:50:06
Message-ID: A2F9A8CA-7B1D-4745-9B0E-56ED0FBC87FA@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


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(dot)kumar(at)enterprisedb(dot)com
Blog:http://vibhork.blogspot.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andre Lopes 2011-03-06 14:58:21 Re: PHP array to PlPgSQL arrat. How to?
Previous Message Alexander Farber 2011-03-06 13:43:32 Copying few tables from one database to another