After upgrading from Fedora 15 to Fedora 16, I noticed Postgres was no longer running, so I tried to start it up:
sudo systemctl status postgresql.service
This printed the error "Job failed. See system logs and 'systemctl status' for details."
Inspecting /var/log/messages revealed:
Feb 29 12:51:39 jetengine postgresql-check-db-dir[4912]: An old version of the database format was found.
Feb 29 12:51:39 jetengine postgresql-check-db-dir[4912]: Use "postgresql-setup upgrade" to upgrade to version 9.1.
Feb 29 12:51:39 jetengine postgresql-check-db-dir[4912]: See /usr/share/doc/postgresql-9.1.2/README.rpm-dist for more information.
Feb 29 12:51:39 jetengine systemd[1]: postgresql.service: control process exited, code=exited status=1
Feb 29 12:51:39 jetengine systemd[1]: Unit postgresql.service entered failed state.
So I needed to upgrade to the new 9.1 format.
I used the following command to check the current version of my database:
sudo cat /var/lib/pgsql/data/PG_VERSION
This returned "9.0".
To upgrade the database, I first needed to install the postgresql-upgrade package:
sudo yum install -y postgresql-upgrade
I then ran the following command to update the database:
sudo postgresql-setup upgrade
This command took a minute or two to complete. Once it was done, the database at /var/lib/pgsql/data/ was in 9.1 format, and the old 9.0 format database was saved to /var/lib/pgsql/data-old/
However, the upgrade tool did not copy over my old pg_hba.conf, so I had to do that myself:
sudo mv /var/lib/pgsql/data-old/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
Now I was able to successfully start up Postgres 9.1:
sudo systemctl start postgresql.service