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 1eiOpv-0001kG-NY for pgsql-admin@arkaria.postgresql.org; Sun, 04 Feb 2018 18:16:19 +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 1eiOpu-0003Ua-5R for pgsql-admin@arkaria.postgresql.org; Sun, 04 Feb 2018 18:16:18 +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 1eiOpt-0003UQ-Uw for pgsql-admin@lists.postgresql.org; Sun, 04 Feb 2018 18:16:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eiOpn-0001s6-93 for pgsql-admin@postgresql.org; Sun, 04 Feb 2018 18:16:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w14IG9ix018203; Sun, 4 Feb 2018 13:16:09 -0500 From: Tom Lane To: robert cc: pgsql-admin@postgresql.org Subject: Re: pg_restore has problems with restoring sequences. In-reply-to: References: <129cd073-60bf-96db-e129-24bd9a37319e@redcor.ch> <15766.1517758986@sss.pgh.pa.us> Comments: In-reply-to robert message dated "Sun, 04 Feb 2018 17:53:28 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <18201.1517768169.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 04 Feb 2018 13:16:09 -0500 Message-ID: <18202.1517768169@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk robert writes: > pg_restore: [archiver (db)] Error while PROCESSING TOC: > pg_restore: [archiver (db)] Error from TOC entry 1068; 1259 142848 SEQUE= NCE = > change_email_domain_id_seq odoo > pg_restore: [archiver (db)] could not execute query: ERROR:=C2=A0 syntax= error at or = > near "AS" > LINE 2:=C2=A0=C2=A0=C2=A0=C2=A0 AS integer > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ^ > =C2=A0=C2=A0=C2=A0 Command was: CREATE SEQUENCE change_email_domain_id_= seq > =C2=A0=C2=A0=C2=A0 AS integer > =C2=A0=C2=A0=C2=A0 START WITH 1 > =C2=A0=C2=A0=C2=A0 INCREMENT BY 1 > =C2=A0=C2=A0=C2=A0 NO MINVALUE > =C2=A0=C2=A0=C2=A0 NO MAXVALU... Hm. What this suggests is that you're using a pg_dump that is newer than the server that you're trying to restore to. The "AS datatype" clause in CREATE SEQUENCE is new in v10. The general rule for pg_dump version choice is "use the newest version you can, but not newer than the server you're going to restore to". Otherwise you run into problems like this of the dump containing syntax the target server doesn't understand. regards, tom lane