From: banghe <banghe@baileylink.net>
To: Mike Darretta <michael.darretta.ctr@metnet.navy.mil>
Cc: pgsql-admin@postgresql.org
Subject: Re: Migrating Data Between PG Tables
Date: Tue, 05 Oct 2004 15:21:55 -0500
Message-ID: <41630263.1080301@baileylink.net> (raw)
In-Reply-To: <41630082.4090802@metnet.navy.mil>
References: <200410050159.i951xOH02113@candle.pha.pa.us>
<41630082.4090802@metnet.navy.mil>
One sql statement can solve this:
sql> isnert into table_b (id, name, summary) select id, name, desc from
table_a;
Banghe
Mike Darretta wrote:
> Does anyone have a suggestion on the best way to migrate data between
> two slightly different tables? For example:
>
> Table A
> --------
> id : integer
> name : string
> desc : string
>
>
> Table B
> --------
> id : integer
> name : string
> date : date
> summary : string
>
> In this example, I would like to copy all the data from Table A into
> B, using the desc column to populate the summary column.
>
> Thanks,
> Mike
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: banghe@baileylink.net, michael.darretta.ctr@metnet.navy.mil
Subject: Re: Migrating Data Between PG Tables
In-Reply-To: <41630263.1080301@baileylink.net>
References: <200410050159.i951xOH02113@candle.pha.pa.us> <41630082.4090802@metnet.navy.mil> <41630263.1080301@baileylink.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox