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 1gIL0a-0003BA-Ee for pgsql-general@arkaria.postgresql.org; Thu, 01 Nov 2018 22:00:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gIL0Z-0005IS-7a for pgsql-general@arkaria.postgresql.org; Thu, 01 Nov 2018 22:00:07 +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 1gIKxI-0007RH-9M for pgsql-general@lists.postgresql.org; Thu, 01 Nov 2018 21:56:44 +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 1gIKxE-0004Nb-5S for pgsql-general@postgresql.org; Thu, 01 Nov 2018 21:56:42 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id E4AE7992D4 for ; Thu, 1 Nov 2018 14:56:37 -0700 (PDT) Date: Thu, 1 Nov 2018 14:56:37 -0700 (PDT) From: Rich Shepard To: pgsql-general@postgresql.org Subject: Re: Add columns to table; insert values based on row Message-ID: User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, 2 Nov 2018, Tim Cross wrote: > 3. Is it really insert or update you need? Tim, Update. It's been a long time since I did any database manipulation (I just use the existing databases as each project needs its data) so I sometimes make these types of mistakes. Your idea of manipulating a text file is a great one! I'll use gawk to extract the relevant fields from the text file in which they reside (in the correct order), then use emacs keyboard macros to add the appropriate update text to each line. Must more efficient (and less tedious) than manually writing each line. Thanks, Rich