Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBhJ1-0002oF-MC for pgsql-general@arkaria.postgresql.org; Wed, 03 Apr 2019 14:55:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hBhJ0-0005gr-3T for pgsql-general@arkaria.postgresql.org; Wed, 03 Apr 2019 14:55:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBhIz-0005gj-Mt for pgsql-general@lists.postgresql.org; Wed, 03 Apr 2019 14:55:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hBhIs-0003Y6-UW for pgsql-general@lists.postgresql.org; Wed, 03 Apr 2019 14:55:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x33Etn6s013609; Wed, 3 Apr 2019 10:55:49 -0400 From: Tom Lane To: Steven Lembark cc: "pgsql-general@lists.postgresql.org" Subject: Re: Move vs. copy table between databases that share a tablespace? In-reply-to: <12183.1554300654@sss.pgh.pa.us> References: <20190403081825.14dc71c9.lembark@wrkhors.com> <12183.1554300654@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Wed, 03 Apr 2019 10:10:54 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13607.1554303349.1@sss.pgh.pa.us> Date: Wed, 03 Apr 2019 10:55:49 -0400 Message-ID: <13608.1554303349@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > Steven Lembark writes: >> Given that the two databases live in the same cluster and have >> the owner & the tablespace in common, is there any way to move >> the contents without a dump & reload? > In principle you could do that; it's more or less the same thing that > pg_upgrade --link does. Actually, thinking about that a bit harder: there's one aspect of what pg_upgrade does that's really hard to control from userspace, and that's forcing tables to have the same OIDs as before. In this context, that means you're probably out of luck if the table has a TOAST table, unless the TOAST table is empty. There wouldn't be any good way to keep TOAST pointers valid across the move. (PG v12 will make that easier, but that's no help to you today.) regards, tom lane