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 1gvS9v-0003yz-Fr for pgsql-admin@arkaria.postgresql.org; Sun, 17 Feb 2019 19:31:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gvS9u-00058l-9U for pgsql-admin@arkaria.postgresql.org; Sun, 17 Feb 2019 19:31:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvS9u-00058e-1z for pgsql-admin@lists.postgresql.org; Sun, 17 Feb 2019 19:31:26 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gvS9r-0002BW-K3 for pgsql-admin@lists.postgresql.org; Sun, 17 Feb 2019 19:31:25 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:105:465:1:1:0]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id D596FA11B8; Sun, 17 Feb 2019 20:31:19 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id WS29qvtW3euH; Sun, 17 Feb 2019 20:31:15 +0100 (CET) Message-ID: <41dbc1307b3ebe4c9251194f5f380ca44cc8dc66.camel@cybertec.at> Subject: Re: pg_restore fails to restore sequence of specific table From: Laurenz Albe To: Mariel Cherkassky , pgsql-admin@lists.postgresql.org Date: Sun, 17 Feb 2019 20:31:14 +0100 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Mariel Cherkassky wrote: > I have a backup of an entire db(9.2.5) that was taken with the next command : > pg_dump -U postgres -Fc my_db > mydb.dump > > Now, I'm trying to restore a specific table (with its sequence) but I'm getting the following error error: > pg_restore -d mydb -U postgres -v -t specific_table mydb.dump > output : > pg_restore: connecting to database for restore > Password: > pg_restore: creating TABLE specific_table > pg_restore: [archiver (db)] Error while PROCESSING TOC: > pg_restore: [archiver (db)] Error from TOC entry 241; 1259 4236973 TABLE specific_table postgres > pg_restore: [archiver (db)] could not execute query: ERROR: relation "specific_table_id_seq" does not exist > Command was: CREATE TABLE specific_table( > id integer DEFAULT nextval('specific_id_seq'::regclass) NOT NULL, > effectiveid integer DEFAULT ... > pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.specific_table" does not exist > Command was: ALTER TABLE public.specific_table OWNER TO postgres; You have to restore the sequence as well: pg_restore -t specific_table -t specific_table_id_seq ... > I tried to generate a plain text from the dump : > pg_restore -U postgres -t specific mydb.dump > output > However, the output file doesnt contain the creation command of the sequence. Well, it isn't called "specific", is it? Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com