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 1vWd63-006BAY-1d for pgsql-general@arkaria.postgresql.org; Fri, 19 Dec 2025 16:12:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vWd62-008O2d-1R for pgsql-general@arkaria.postgresql.org; Fri, 19 Dec 2025 16:12:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <0102019b37627d9c-03ffe58c-44b4-4245-8cde-fb8f84b97509-000000@mail.rodonnell.ie>) id 1vWd61-008NqX-33 for pgsql-general@lists.postgresql.org; Fri, 19 Dec 2025 16:12:50 +0000 Received: from a7-34.smtp-out.eu-west-1.amazonses.com ([54.240.7.34]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from <0102019b37627d9c-03ffe58c-44b4-4245-8cde-fb8f84b97509-000000@mail.rodonnell.ie>) id 1vWd5v-001X7u-0t for pgsql-general@postgresql.org; Fri, 19 Dec 2025 16:12:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=pttss7zjfbrazujxl6mrlo4sg34ocala; d=rodonnell.ie; t=1766160760; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=KzzJ+67lvr+8Izx0NlLDl7EosK9OWLjIi7Pr7T+RjqI=; b=yywyKcSoWEVDnlW+146ERnvZ66GL8cONS/OPKk7PRPfzeMNb1QSpbgxF3IRrcotv L8fcltN9vCNuAipWvbekXweXVWngcJOp6qfreNWAVHmAlDtjLmOEDHgll5lWevS5qA3 RKWK0bHf0mjhTL8zRuiretx0sXPIPXJw9RgljWFVpoDmKhhR+rzz9YOQHiPCAMeZdrx sfSkCQt+bnR4iuJ1ZtqTWkphJAeq4VMc2EZKs/onP6UnRKZcAGgWXxsb2X8yIXHLLaj Dsr+XH5dnfnZDj9PgN0ozF0pY+J1rjrN+VpLwquUwUM+mjrF+lSCCPEgER40OI0LFqP z/mSdNgMpg== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ihchhvubuqgjsxyuhssfvqohv7z3u4hn; d=amazonses.com; t=1766160760; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID; bh=KzzJ+67lvr+8Izx0NlLDl7EosK9OWLjIi7Pr7T+RjqI=; b=VZtoBlXo3jxB6i5fxCyxdZ8YUL/y0BGr7YVdchd7BCXSB4BwMOrReefiG0b1cJU+ F+EcXx9lpZDENETBN1D+t5EO2XCd6RCOepWmuOUdl2LJMlVWOsWZFkEx12fiR2+S2QY YGSR6xsKfnz/2k86TpQ+UlFYOQAoKKbI7RZGL0Tg= Message-ID: <0102019b37627d9c-03ffe58c-44b4-4245-8cde-fb8f84b97509-000000@eu-west-1.amazonses.com> Date: Fri, 19 Dec 2025 16:12:40 +0000 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-GB From: Ray O'Donnell In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Feedback-ID: ::1.eu-west-1.Bw1eu/7Uepg3xcsiFBL71JJRCh2A2yTFrgBhhiulXmU=:AmazonSES X-SES-Outgoing: 2025.12.19-54.240.7.34 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 19/12/2025 12: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 haven't tried it, but - off the top of my head - how about: (i) Create the table separately by hand, without the FK references. (ii) Do a data-only restore, using the -a and -t options to pg_restore Ray. > I need to get table data only. Using PostgresSql 17 in windows. > > Andrus. > > -- Ray O'Donnell // Galway // Ireland ray@rodonnell.ie