pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedMigrating Data Between PG Tables
3+ messages / 2 participants
[nested] [flat]
* Migrating Data Between PG Tables
@ 2004-10-05 20:13 Mike Darretta <michael.darretta.ctr@metnet.navy.mil>
0 siblings, 1 reply; 3+ messages in thread
From: Mike Darretta @ 2004-10-05 20:13 UTC (permalink / raw)
To: pgsql-admin
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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Migrating Data Between PG Tables
@ 2004-10-05 20:21 banghe <banghe@baileylink.net>
parent: Mike Darretta <michael.darretta.ctr@metnet.navy.mil>
0 siblings, 1 reply; 3+ messages in thread
From: banghe @ 2004-10-05 20:21 UTC (permalink / raw)
To: Mike Darretta <michael.darretta.ctr@metnet.navy.mil>; +Cc: pgsql-admin
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
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Migrating Data Between PG Tables
@ 2004-10-05 20:29 Mike Darretta <michael.darretta.ctr@metnet.navy.mil>
parent: banghe <banghe@baileylink.net>
0 siblings, 0 replies; 3+ messages in thread
From: Mike Darretta @ 2004-10-05 20:29 UTC (permalink / raw)
To: banghe <banghe@baileylink.net>; +Cc: pgsql-admin
banghe wrote:
> 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
>>
>
>
Thanks. I figured it was simple...
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2004-10-05 20:29 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-05 20:13 Migrating Data Between PG Tables Mike Darretta <michael.darretta.ctr@metnet.navy.mil>
2004-10-05 20:21 ` banghe <banghe@baileylink.net>
2004-10-05 20:29 ` Mike Darretta <michael.darretta.ctr@metnet.navy.mil>
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