Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fHwHj-0001dl-Dy for pgsql-general@arkaria.postgresql.org; Sun, 13 May 2018 19:03:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fHwHh-0002pI-UR for pgsql-general@arkaria.postgresql.org; Sun, 13 May 2018 19:03:53 +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.89) (envelope-from ) id 1fHwHh-0002p8-MK for pgsql-general@lists.postgresql.org; Sun, 13 May 2018 19:03:53 +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 1fHwHe-0003k0-K8 for pgsql-general@postgresql.org; Sun, 13 May 2018 19:03:53 +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 w4DJ3ee6032258; Sun, 13 May 2018 15:03:40 -0400 From: Tom Lane To: "Andrus" cc: "pgsql-general" Subject: Re: How to migrate database from 10.1 to 9.1 In-reply-to: <0B65DCA2835A4244B432B4AA48B6BDEE@dell2> References: <0B65DCA2835A4244B432B4AA48B6BDEE@dell2> Comments: In-reply-to "Andrus" message dated "Sun, 13 May 2018 18:54:37 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32256.1526238220.1@sss.pgh.pa.us> Date: Sun, 13 May 2018 15:03:40 -0400 Message-ID: <32257.1526238220@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Andrus" writes: > Database is created in > "PostgreSQL 10.1 on x86_64-pc-mingw64, compiled by gcc.exe (Rev5, Built > by MSYS2 project) 4.9.2, 64-bit" > and contains tables with autogenerated primary keys like > ... > if this database is restored to Postgres 9.1 from custom backup using > ... > automatic primary key generation stops working. This is a bit unfortunate, because it's not obvious to the naked eye that a SERIAL column (I assume you actually defined the column as SERIAL?) is using any new-in-v10 syntax. But it is. If you'd looked at the error output you'd have noticed that the CREATE SEQUENCE command is getting a syntax error: psql:testv10.dump:58: ERROR: syntax error at or near "AS" LINE 2: AS integer ^ You'd need to edit the dump output to remove the "AS integer" clause in order to get this dump to load into a pre-v10 server. Alternatively, I believe creating the column as BIGSERIAL would result in dump files that would reload into older servers without adjustments. regards, tom lane