0

I have Postgres 9.5 running on "old" Debian server and about to move it on "new" CentOS, so here is the question. Is it OK to just install binaries of the same 9.5 version and just copy database cluster (PGDATA) to a new server?

6
  • 2
    I think it should be OK, but why keep the old version? 9.5 is going to be unsupported in about 3 months. Can't you take the opportunity to also upgrade Postgres (which would require a dump & reload though) Nov 3 '20 at 9:49
  • @a_horse_with_no_name wouldn't an upgrade version by version be preferable? 9->10->11->12. And using the link option to speed things up. Nov 3 '20 at 10:02
  • @GerardH.Pille: no need. You can go directly from 9.x to 13. You could even use pg_upgrade to do that if both the old and new version were located on the same machine Nov 3 '20 at 10:04
  • Hi, also suggested it to database owner, but here is like minimal question. Thank you for pointing out EOL. Nov 3 '20 at 10:04
  • 1
    Regardless of whether or not it should work, you should test this first. Nov 3 '20 at 10:05
2

The immediate problem you are going to hit is that there will be a different version of the C library, and your collations will change. So, unless you are using the C collation, either move the database with pg_dumpall/restore or , if you copy the data directory, REINDEX all indexes that are defined on columns with a string data type.

Also make sure that both systems are either 32-bit or 64-bit when copying the data directory.

And upgrading PostgreSQL is not a "tricky political enterprise-world question". After all, PostgreSQL doesn't get any money if you upgrade. If you are not running a supported release, you won't get updates, so you will be exposed to data corruption bugs.

Of course you want to have the same release as the client. Your task is to drive the danger home to the customer.

1
  • Thank you for such a detailed answer! did it with pg_dumpall Nov 6 '20 at 12:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.