Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIJvV-0000G1-7Z for pgsql-general@arkaria.postgresql.org; Thu, 01 Nov 2018 20:50:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIJvT-0008OC-Ms for pgsql-general@arkaria.postgresql.org; Thu, 01 Nov 2018 20:50:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIJvT-0008O5-EM for pgsql-general@lists.postgresql.org; Thu, 01 Nov 2018 20:50:47 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gIJvN-0002so-CY for pgsql-general@postgresql.org; Thu, 01 Nov 2018 20:50:47 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 1410A992D4 for ; Thu, 1 Nov 2018 13:50:39 -0700 (PDT) Date: Thu, 1 Nov 2018 13:50:39 -0700 (PDT) From: Rich Shepard To: pgsql-general@postgresql.org Subject: Re: Add columns to table; insert values based on row In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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