Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eiNXp-0004KO-SW for pgsql-admin@arkaria.postgresql.org; Sun, 04 Feb 2018 16:53:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eiNXo-0001NY-Mp for pgsql-admin@arkaria.postgresql.org; Sun, 04 Feb 2018 16:53:32 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eiNXo-0001NO-Fs for pgsql-admin@lists.postgresql.org; Sun, 04 Feb 2018 16:53:32 +0000 Received: from susanne.redcor.ch ([178.63.103.72]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eiNXl-0000Am-HW for pgsql-admin@postgresql.org; Sun, 04 Feb 2018 16:53:31 +0000 Received: from [192.168.0.100] (84-72-41-168.dclient.hispeed.ch [84.72.41.168]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: robert@redcor.ch) by susanne.redcor.ch (Postfix) with ESMTPSA id 87B03A01D5; Sun, 4 Feb 2018 17:53:28 +0100 (CET) From: robert Subject: Re: pg_restore has problems with restoring sequences. To: robert Cc: pgsql-admin@postgresql.org References: <129cd073-60bf-96db-e129-24bd9a37319e@redcor.ch> <15766.1517758986@sss.pgh.pa.us> Message-ID: Date: Sun, 4 Feb 2018 17:53:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <15766.1517758986@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thanks Tom On 04.02.2018 16:43, Tom Lane wrote: > robert writes: >> I use >>     pg_dump -h localhost  -U USER -Fc DATABASE > dumpfile > OK ... > >> then I restore it with: >>     dropdb DATABASE >>     pg_restore -O  -U user  -d DATABASE  dumpfile > That sequence is missing a createdb step (or else -C in the restore > switches). yes, I am using also the -C switch sorry > >> doing this then I get these warnings, and many (not all) sequences are not created. > Usually the thing to do is look at the very first error; everything after > that may just be cascading damage. I kinda doubt what you showed us > here is the first error. no its not, but they are all similar, I assumed (maybe wrongly) that it makes no difference .. Here are the first couple: pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 1068; 1259 142848 SEQUENCE change_email_domain_id_seq odoo pg_restore: [archiver (db)] could not execute query: ERROR:  syntax error at or near "AS" LINE 2:     AS integer             ^     Command was: CREATE SEQUENCE change_email_domain_id_seq     AS integer     START WITH 1     INCREMENT BY 1     NO MINVALUE     NO MAXVALU... pg_restore: [archiver (db)] Error from TOC entry 11717; 0 0 SEQUENCE OWNED BY change_email_domain_id_seq odoo pg_restore: [archiver (db)] could not execute query: ERROR: relation "change_email_domain_id_seq" does not exist     Command was: ALTER SEQUENCE change_email_domain_id_seq OWNED BY change_email_domain.id; pg_restore: [archiver (db)] Error from TOC entry 1062; 1259 134467 SEQUENCE change_email_wizard_id_seq odoo pg_restore: [archiver (db)] could not execute query: ERROR:  syntax error at or near "AS" LINE 2:     AS integer             ^     Command was: CREATE SEQUENCE change_email_wizard_id_seq     AS integer     START WITH 1     INCREMENT BY 1     NO MINVALUE     NO MAXVALU... pg_restore: [archiver (db)] Error from TOC entry 11724; 0 0 SEQUENCE OWNED BY change_email_wizard_id_seq odoo pg_restore: [archiver (db)] could not execute query: ERROR: relation "change_email_wizard_id_seq" does not exist     Command was: ALTER SEQUENCE change_email_wizard_id_seq OWNED BY change_email_wizard.id; pg_restore: [archiver (db)] Error from TOC entry 1070; 1259 142859 SEQUENCE delete_user_confirm_wizard_id_seq odoo pg_restore: [archiver (db)] could not execute query: ERROR:  syntax error at or near "AS" LINE 2:     AS integer             ^     Command was: CREATE SEQUENCE delete_user_confirm_wizard_id_seq     AS integer     START WITH 1     INCREMENT BY 1     NO MINVALUE     NO ... pg_restore: [archiver (db)] Error from TOC entry 12169; 0 0 SEQUENCE OWNED BY delete_user_confirm_wizard_id_seq odoo pg_restore: [archiver (db)] could not execute query: ERROR: relation "delete_user_confirm_wizard_id_seq" does not exist     Command was: ALTER SEQUENCE delete_user_confirm_wizard_id_seq OWNED BY delete_user_confirm_wizard.id; pg_restore: [archiver (db)] Error from TOC entry 1066; 1259 140393 SEQUENCE news_publish_queue_id_seq odoo pg_restore: [archiver (db)] could not execute query: ERROR:  syntax error at or near "AS" LINE 2:     AS integer             ^     Command was: CREATE SEQUENCE news_publish_queue_id_seq     AS integer     START WITH 1     INCREMENT BY 1     NO MINVALUE     NO MAXVALUE... pg_restore: [archiver (db)] Error from TOC entry 13336; 0 0 SEQUENCE OWNED BY news_publish_queue_id_seq odoo pg_restore: [archiver (db)] could not execute query: ERROR: relation "news_publish_queue_id_seq" does not exist     Command was: ALTER SEQUENCE news_publish_queue_id_seq OWNED BY news_publish_queue.id; thanks again robert