Because of some (not very clear reasons to me) I forgot to upgrade the postgresql daemon in the distribution upgrade on one of my Debian servers. The Postgresql daemon has the nice feature of not starting to use its new version (unlike Mysql) until we are convinced, that the new one is fully compatible with the launch – extremely useful in large databases. The update process itself is limited to the following 2 steps:

  • pg_dropcluster
  • pg_upgradecluster

The pg daemon must be stopped before you can drop the cluster!

pg_dropcluster 9.4 main

This command passes quickly, then we move on to the essential part – the upgrade itself

pg_upgradecluster 9.1 main
Disabling connections to the old cluster during upgrade...
Restarting old cluster with restricted connections...
Creating new cluster 9.4/main ...
config /etc/postgresql/9.4/main
data   /var/lib/postgresql/9.4/main
locale en_US.UTF-8
Flags of /var/lib/postgresql/9.4/main set as -------------e-C
port   5433
Disabling connections to the new cluster during upgrade...
Roles, databases, schemas, ACLs...
Fixing hardcoded library paths for stored procedures...
Upgrading database postgres...
Analyzing database postgres...
Fixing hardcoded library paths for stored procedures...
Upgrading database template1...
Analyzing database template1...
Fixing hardcoded library paths for stored procedures...
Upgrading database xpqt...
Analyzing database xpqt...
Re-enabling connections to the old cluster...
Re-enabling connections to the new cluster...
Copying old configuration files...
Copying old start.conf...
Copying old pg_ctl.conf...
Copying old server.crt...
Copying old server.key...
Stopping target cluster...
Stopping old cluster...
Disabling automatic startup of old cluster...
Configuring old cluster to use a different port (5433)...
Starting target cluster on the original port...
Success. Please check that the upgraded cluster works. If it does,
you can remove the old cluster with

pg_dropcluster 9.1 main

If everything went smoothly you should receive a message like the above which prompts you to get rid of the old data from pg.

pg_dropcluster 9.1 main

At the end of this tarpan, you can now start your process again. For me, the bases are small and unfortunately I can't estimate how long the significant upgrade takes..