Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWd5r-006B5j-0t for pgsql-general@arkaria.postgresql.org; Fri, 19 Dec 2025 16:12:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vWd5p-008LPW-0b for pgsql-general@arkaria.postgresql.org; Fri, 19 Dec 2025 16:12:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWd5o-008LPN-0z for pgsql-general@lists.postgresql.org; Fri, 19 Dec 2025 16:12:37 +0000 Received: from fout-b3-smtp.messagingengine.com ([202.12.124.146]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vWd5l-001cwt-1v for pgsql-general@postgresql.org; Fri, 19 Dec 2025 16:12:36 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id 80FC51D0011D; Fri, 19 Dec 2025 11:12:30 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Fri, 19 Dec 2025 11:12:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1766160750; x=1766247150; bh=bHjn0b+NpanTicV9xfHNzfi3jPCUZrujJWCTZyfKCy0=; b= uQuHC4Db86cyMMcVMXojXdnbAbwJgivjvMY3tiCVEOcKttDOmWbJCZRwZBCO2anB b3AmEQVGHFoIX6YZvZQ4SlxLVCvOMUdg8bPzexVdoGPmBoa9+1Jh5Ka24uMR2ZRm Moj6FSr1pYaFug4y69O03mvaZfwAHA/ZZOoXqOAvm4mwBWdc2dQsFWWY6bCI16L8 OVHjGi+Z/JjG3Z1zSZo3WQOZdAoB5vuZQSiPoZivDg1qF8NtwAL+NpOVzf2q0393 kj9abcoN/G8rfrqCGgWs/x0r3fKVuSH4tabu1ae2xMkb8FFZvUPRLNjC4Xj+Ra4S pgHYw7jT5htSqEXYKQkUfQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1766160750; x=1766247150; bh=b Hjn0b+NpanTicV9xfHNzfi3jPCUZrujJWCTZyfKCy0=; b=oe0Hcc8HgNzXbRe6j 99SfcnInrp0GvyVh1b7e7ZUH3Ml8ocWZxTGc/f/FScPuOMnMDayPAxO2f0uWCX1W xEzNGmDwhgOh05wGCuPoDzzMVKk9dHQ3JMih+mra/GjopD+SVupIXZ6zvsLI8XKb QqjNnuR9+oxAVMnXZhWhARhvLIwwsWk0rZ3rBjjkNcUoUDZiBsmVeajeXwMXtxCU k29qBFq0+8b9w/AqbIw+87lkRUXEmE8NqasOlqjqlImrWAshn9AeCKa4ursLdFo4 UmCEbMIYmBftnhIOIM4X2ivqMj+EztdXLZnpLwymrOeo+pUJeEM8XVc4l4XTXrYr M3Ccg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdegkeejhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthekredttd dvjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghv vghrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeffleegieefgfevud ehtdfhkeeutdffjeevgeffgeejvedthefgudeiteefheejheenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrse grkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehkohgsrhhulhgvhhhtvdeshhhothdrvggvpdhrtghpthhtohepph hgshhqlhdqghgvnhgvrhgrlhesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 19 Dec 2025 11:12:29 -0500 (EST) Message-ID: Date: Fri, 19 Dec 2025 08:12:29 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: How to get single table data from backup To: Andrus , pgsql-general References: Content-Language: en-US From: Adrian Klaver In-Reply-To: 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: Archived-At: Precedence: bulk On 12/19/25 04:41, Andrus wrote: > Hi! > > Large database backup is created using > > pg_dump -b -f backup.backup -F c > > How to restore single table in schema firma2 from it in Windows? > > Created database recovery and tried > > pg_restore --schema-only --n firma2 -d recovery backup.backup > pg_restore -n firma2 -t tabletorecover -d recovery backup.backup > > This fails since tabletorecover contains lot foreign key references. > Foreign keys refer to other tables which have foreign keys to another > tables etc. making huge graph. All tables contain also data. > > I need to get table data only. Using PostgresSql 17 in windows. 1) Does the table name tabletorecover occur in more then one SCHEMA? 2) Do you want only the table data for tabletorecover? Assuming 1 is one SCHEMA only and 2 is tabletorecover data only then maybe something like: 1) pg_restore --schema-only --table=tabletorecover -d recovery backup.backup 2) In psql ALTER TABLE tabletorecover DROP CONSTRAINT the FK references in tabletorecover. 3) pg_restore --data-only --table=tabletorecover -d recovery backup.backup > > Andrus. > > -- Adrian Klaver adrian.klaver@aklaver.com