Re: copying between Postgres databases

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: javier garcia - CEBAS <rn001(at)cebas(dot)csic(dot)es>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: copying between Postgres databases
Date: 2003-03-18 19:21:06
Message-ID: Pine.LNX.4.33.0303181219460.5388-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 17 Mar 2003, javier garcia - CEBAS wrote:

> Hi;
> I've got two questions:
>
> 1) What is the best way to copy a Postgres table in one database into another
> Postgres database? Is it possible to copy the structure and the data at the
> same time?
>
> 2) Is there a way to do a short of pg_dump and to use the resulting file as
> input to another database, but preserving existing tables in this latter?

Sure, just pipe the output of pg_dump to psql:

pg_dump database1 -t tablename | psql database2 -e

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kurt Overberg 2003-03-18 19:35:22 Re: Big insert/delete memory problems
Previous Message Tom Lane 2003-03-18 18:49:26 Re: unexpected join results