Thread: Needs Suggestion

Needs Suggestion

From
SUBHAM ROY
Date:
Suppose Postgres is installed in two computers C1 & C2.
C1 have some database tables. How can I copy these database tables from C1 to C2.
I mean to say that can I copy tables from postgres installed in one m/c to another m/c.
Is there any command in postgres to do so or any other short cut technique.

--
Thank You,
Subham Roy,
CSE IIT Bombay.

Re: Needs Suggestion

From
Scott Marlowe
Date:
On Tue, Apr 19, 2011 at 5:06 PM, SUBHAM ROY <subham.iem@gmail.com> wrote:
> Suppose Postgres is installed in two computers C1 & C2.
> C1 have some database tables. How can I copy these database tables from C1
> to C2.
> I mean to say that can I copy tables from postgres installed in one m/c to
> another m/c.
> Is there any command in postgres to do so or any other short cut technique.

Assuming you don't have to worry about foreign keys etc, you can dump
a table from one db and feed it to a psql session open to another:

pg_dump -h host1 dbname -t tablename | psql -h host2 dbname

and so on.