In my ubuntu 12.04 x64 I installed PostgreSQL 8.4. It got automatically upgraded to 9.1.1. Due to some inconsistencies, I want to downgrade it to 8.4. How can I do this using the terminal?
Ubuntu does not automatically upgrade PostgreSQL 8.4 to 9.1. What probably happened is that 9.1 is now installed alongside the old 8.4, and the client tools you are using prefer to connect to the 9.1 instance. Try
I am not sure downgrading is the best thing to do here. After all there are reasons why upgrades are made. I do understand that there are cases in which upgrading is not obvious.
If you do want to downgrade there are two options and I strongly advice the second option.
Manually install an earlier version of PostgreSQL
Run the following commands (taken from http://colekcolek.com/2012/02/23/downgrade-postgresql-8-2-ubuntu-11-10/):
You will be responsible yourself for maintaining the postgres install.
Use an APT Repository
There is a repository that could help you here. In terms of maintenance that is definitely the better option. Here is an extensive quote from http://www.postgresql.org/download/linux/ubuntu/:
There is also a PPA, but I think it is deprecated in favour of the repository: