Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMxXE-0008VZ-Ah for pgsql-general@arkaria.postgresql.org; Mon, 28 Sep 2020 18:06:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kMxXD-0005px-9H for pgsql-general@arkaria.postgresql.org; Mon, 28 Sep 2020 18:05:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMxXD-0005po-1f for pgsql-general@lists.postgresql.org; Mon, 28 Sep 2020 18:05:59 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kMxX6-0000UE-I6 for pgsql-general@lists.postgresql.org; Mon, 28 Sep 2020 18:05:58 +0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 8E54E260DCB for ; Mon, 28 Sep 2020 11:05:49 -0700 (PDT) Date: Mon, 28 Sep 2020 11:05:49 -0700 (PDT) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: Modifying database schema without losing data In-Reply-To: <945982c5-197f-d3b3-5c15-010cff998bdc@aklaver.com> Message-ID: References: <945982c5-197f-d3b3-5c15-010cff998bdc@aklaver.com> 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 Mon, 28 Sep 2020, Adrian Klaver wrote: > You could use INSERT INTO location(new_fields,) SELECT the_fields FROM > the_table(s). Well, duh! I could have thought of that. That's exactly what I'll do: Create the new table, move data from the old table into it, then drop columns in the old table ... after checking all data's there. Thanks, Adrian. Stay well, Rich