Updating from PostgreSQL 8.4 to PostgreSQL 9.1

UCS-4.x and UCS-3.3 ships PostgreSQL 9.1 by default, while previous UCS versions shipped PostgreSQL 8.4 by default. When such systems are updated, however, the installed PostgreSQL version is retained.

The following steps are necessary on a UCS-4.x or UCS-3.3 system for updating PostgreSQL 8.4 to PostgreSQL 9.1

[ -f /usr/sbin/univention-pkgdb-scan ] && chmod -x /usr/sbin/univention-pkgdb-scan
service postgresql stop
rm -rf /etc/postgresql/9.1
apt-get install --reinstall postgresql-9.1
pg_dropcluster 9.1 main --stop
service postgresql start
test -e /var/lib/postgresql/9.1/main && mv /var/lib/postgresql/9.1/main /var/lib/postgresql/9.1/main.old
pg_upgradecluster 8.4 main
# This will print an error message about SHMMAX, which should be ignored
ucr commit /etc/postgresql/9.1/main/*
chown -R postgres:postgres /var/lib/postgresql/9.1
service postgresql restart
[ -f /usr/sbin/univention-pkgdb-scan ] && chmod +x /usr/sbin/univention-pkgdb-scan
test "$(ucr get version/version)" = 3.3 && univention-install --yes univention-postgresql-9.1

Once the new database / data inventory has been verified, the PostgreSQL 8.4 data can be removed / the software package uninstalled:

pg_dropcluster 8.4 main --stop
dpkg -P postgresql-8.4