Re: How to copy tables between databases?

Lists: pgsql-general
From: Tom Hart <tomhart(at)coopfed(dot)org>
To: Kynn Jones <kynnjo(at)gmail(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to copy tables between databases?
Date: 2008-02-26 20:19:24
Message-ID: 47C4744C.5010509@coopfed.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Kynn Jones wrote:
>
>
> Is there a simple way to copy a table from one database to another
> without generating an intermediate dump file?
>
> TIA!
>
> Kynn
>
You're looking for ETL.

http://en.wikipedia.org/wiki/Extract%2C_transform%2C_load

--
Tom Hart
IT Specialist
Cooperative Federal
723 Westcott St.
Syracuse, NY 13210
(315) 471-1116 ext. 202
(315) 476-0567 (fax)


From: "Kynn Jones" <kynnjo(at)gmail(dot)com>
To: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: How to copy tables between databases?
Date: 2008-02-26 20:19:36
Message-ID: c2350ba40802261219y4b45d4bn791be819e9a0940f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Is there a simple way to copy a table from one database to another without
generating an intermediate dump file?
TIA!

Kynn


From: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>
To: "Kynn Jones" <kynnjo(at)gmail(dot)com>
Cc: "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to copy tables between databases?
Date: 2008-02-26 20:33:34
Message-ID: 758d5e7f0802261233j56288c6evb784a59ae6c595d7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Tue, Feb 26, 2008 at 9:19 PM, Kynn Jones <kynnjo(at)gmail(dot)com> wrote:
>
> Is there a simple way to copy a table from one database to another without
> generating an intermediate dump file?

Using UNIX pipes :-)

$ pg_dump ... | psql ...

:-)

Regards,
Dawid


From: Brad Nicholson <bnichols(at)ca(dot)afilias(dot)info>
To: Kynn Jones <kynnjo(at)gmail(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to copy tables between databases?
Date: 2008-02-26 20:36:38
Message-ID: 1204058198.5581.22.camel@bnicholson-desktop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Tue, 2008-02-26 at 15:19 -0500, Kynn Jones wrote:
>
> Is there a simple way to copy a table from one database to another
> without generating an intermediate dump file?
>

pg_dump -t <table name> <source DB> | psql -d <target DB>
--
Brad Nicholson 416-673-4106
Database Administrator, Afilias Canada Corp.


From: "Uwe C(dot) Schroeder" <uwe(at)oss4u(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: "Kynn Jones" <kynnjo(at)gmail(dot)com>
Subject: Re: How to copy tables between databases?
Date: 2008-02-26 20:41:05
Message-ID: 200802261241.05502.uwe@oss4u.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


On Tuesday 26 February 2008, Kynn Jones wrote:
> Is there a simple way to copy a table from one database to another without
> generating an intermediate dump file?
> TIA!
>
> Kynn

pg_dump -t [table] [database] | psql -U [remoteuser] -h [remotehost]
[remotedatabase]

comes to mind...

You can and maybe have to add more switches to the pg_dump command, but the
above is what I'm doing (my local db is set to trust) to copy a table with
data to a remote machine

Uwe

--
Open Source Solutions 4U, LLC 1618 Kelly St
Phone: +1 707 568 3056 Santa Rosa, CA 95401
Cell: +1 650 302 2405 United States
Fax: +1 707 568 6416


From: Richard Huxton <dev(at)archonet(dot)com>
To: Kynn Jones <kynnjo(at)gmail(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to copy tables between databases?
Date: 2008-02-26 20:43:54
Message-ID: 47C47A0A.9010700@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Kynn Jones wrote:
> Is there a simple way to copy a table from one database to another without
> generating an intermediate dump file?

Something along the lines of:
pg_dump ... -d db1 --table=mytable | psql -d db2

--
Richard Huxton
Archonet Ltd


From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Brad Nicholson" <bnichols(at)ca(dot)afilias(dot)info>
Cc: "Kynn Jones" <kynnjo(at)gmail(dot)com>, "pgsql-general General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to copy tables between databases?
Date: 2008-02-26 21:00:26
Message-ID: dcc563d10802261300jbe0fdc3yf35afa7e482c60ed@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Tue, Feb 26, 2008 at 2:36 PM, Brad Nicholson
<bnichols(at)ca(dot)afilias(dot)info> wrote:
> On Tue, 2008-02-26 at 15:19 -0500, Kynn Jones wrote:
> >
> > Is there a simple way to copy a table from one database to another
> > without generating an intermediate dump file?
> >
>
> pg_dump -t <table name> <source DB> | psql -d <target DB>

Starting around 8.2 you can have > 1 -t switch, and grab a table or a
wildcarded set of tables with each one.