pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrus <kobruleht2@hot.ee>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to migrate database from 10.1 to 9.1
Date: Sun, 13 May 2018 15:03:40 -0400
Message-ID: <32257.1526238220@sss.pgh.pa.us> (raw)
In-Reply-To: <0B65DCA2835A4244B432B4AA48B6BDEE@dell2>
References: <0B65DCA2835A4244B432B4AA48B6BDEE@dell2>

"Andrus" <kobruleht2@hot.ee> 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




view thread (2+ messages)

Message-ID: <32257.1526238220@sss.pgh.pa.us>
Permalink:  ../32257.1526238220@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/32257.1526238220@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, kobruleht2@hot.ee
  Subject: Re: How to migrate database from 10.1 to 9.1
  In-Reply-To: <32257.1526238220@sss.pgh.pa.us>
  References: <0B65DCA2835A4244B432B4AA48B6BDEE@dell2> <32257.1526238220@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox