Re: best method to copy data across databases

From: reina_ga(at)hotmail(dot)com (Tony Reina)
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: best method to copy data across databases
Date: 2004-07-02 11:10:15
Message-ID: 272e4be7.0407020310.18785557@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

ctrl(at)altonsys(dot)com (ctrl) wrote in message news:<46a31c4d(dot)0407011942(dot)37839bb0(at)posting(dot)google(dot)com>...
> I need to copy data that I have on a table in one Postgres database
> into another table, on a different database. The destination table is
> not identical with the source table so I need to do some mapping
> between the 2 tables.
> What would be the best (and quickest) way to transfer the data? (there
> are over 500k rows)
>
> thanks!

If the 2 tables have different arrangements, then I'm not sure if
there is a quick way. The safest way is probably to do a pg_dump
--attribute-inserts.

From the pg_dump manpage,

--attribute-inserts

Dump data as INSERT commands with explicit column names
(INSERT
INTO table (column, ...) VALUES ...). This will make
restoration
very slow, but it is necessary if you desire to
rearrange the
column ordering.

HTH,
-Tony

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-07-02 14:12:07 Re: best method to copy data across databases
Previous Message Michael Kleiser 2004-07-02 07:04:04 Re: quoting