Upgrading to PostgreSQL 9.5 in Fedora 24

What’s new in PostgreSQL 9.5

PostgreSQL is the world’s leading open source database; in its 9.5 version there are a lot of enhancements, here reported without going in depth:

  • IMPORT FOREIGN SCHEMA
  • Row-Level Security Policies
  • BRIN Indexes
  • Foreign Table Inheritance
  • GROUPING SETS, CUBE and ROLLUP
  • JSONB-modifying operators and functions
  • INSERT … ON CONFLICT DO NOTHING/UPDATE (“UPSERT”)
  • pg_rewind

And a lot of other things, which you can find in detail in the PosgreSQL Wiki.
Here, we’ll care just about upgrading from 9.4 to 9.5 Fedora 24.

Back-up your data

This is just an (important) advice: before proceeding in upgrading, back-up all your data.
The procedure for upgrading PostgreSQL is not automatic, so you have to make some operation manually, but, as you will see, it’s very easy.

Let’s upgrade

First of all, install the upgrade subpackage:

$ sudo dnf install postgresql-upgrade

Now, you can use it to upgrade PostgreSQL:

$ sudo postgresql-setup --upgrade

At the end of the procedure, look at

/var/lib/pgsql/upgrade_postgresql.log

log file for useful details, and then start the systemd service:

$ sudo systemctl start postgresql.service

Now, if you:

$ sudo systemctl status postgresql.service

you should see it started and ready.

That’s all, your PostgreSQL is at 9.5 version, with all its new features available.