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 1oLPHB-0007u5-43 for pgsql-admin@arkaria.postgresql.org; Tue, 09 Aug 2022 13:28:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oLPH9-0006lU-OH for pgsql-admin@arkaria.postgresql.org; Tue, 09 Aug 2022 13:28:03 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLPH9-0006jA-DO for pgsql-admin@lists.postgresql.org; Tue, 09 Aug 2022 13:28:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLPH5-00045d-Ue for pgsql-admin@postgresql.org; Tue, 09 Aug 2022 13:28:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 279DRjfP819155; Tue, 9 Aug 2022 09:27:45 -0400 From: Tom Lane To: Thomas Kellerer cc: pgsql-admin Subject: Re: How to fully restore a single table from a custom dump? In-reply-to: References: Comments: In-reply-to Thomas Kellerer message dated "Tue, 09 Aug 2022 14:06:03 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <819153.1660051665.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 09 Aug 2022 09:27:45 -0400 Message-ID: <819154.1660051665@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Kellerer writes: > Any ideas, how I can _fully_ restore a single table from a custom dump? "pg_restore -l -v" will give you a table-of-contents with dependencies, like this: 8155; 0 40431 MATERIALIZED VIEW DATA public analytics_materialized_view po= stgres ; depends on: 960 8161 This is object number 8155 and it depends on objects 960 and 8161. Find the table you want, then look for things with dependencies on it (some of them may not be things you want to restore). Edit away all the lines for things you don't want, then feed the reduced list to "pg_restore -L". regards, tom lane