Re: Migrating Data Between PG Tables

From: Mike Darretta <michael(dot)darretta(dot)ctr(at)metnet(dot)navy(dot)mil>
To: banghe <banghe(at)baileylink(dot)net>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Migrating Data Between PG Tables
Date: 2004-10-05 20:29:35
Message-ID: 4163042F.3060805@metnet.navy.mil
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)org
>>
>
>
Thanks. I figured it was simple...

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Wim Bertels 2004-10-05 20:43:55 Re: Running 2 postmaster Instances on different ports
Previous Message banghe 2004-10-05 20:21:55 Re: Migrating Data Between PG Tables