Re: Add columns to table; insert values based on row

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Add columns to table; insert values based on row
Date: 2018-11-01 20:50:39
Message-ID: alpine.LNX.2.20.1811011349010.13759@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 1 Nov 2018, Adrian Klaver wrote:

>> alter table stations add column start_date date;
>> alter table stations add column end_date date;
>> alter table stations add column howmany integer;
>> alter table stations add column bin_col char(8);
>>
>> insert into stations (start_date, end_date, howmany, bin_col) values ( )
>>   select site_nbr from stations
>>     where site_nbr = ' ';

> Are you trying to add new data to existing records?

Adrian,

I am adding four columns to an existing table that already contains four
columns.

> If so where is the new data coming from?

I have a text file and will fill each insert statement by hand if there's
not a more efficient way to do this.

Regards,

Rich

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2018-11-01 20:53:25 Re: Add columns to table; insert values based on row
Previous Message Ravi Krishna 2018-11-01 20:49:15 Truncation of UNLOGGED tables upon restart.