Running multiple versions of PostgreSQL on the same Ubuntu server

Assuming Ubuntu does the same thing as Debian, then your two PostGreSQL instances will be running on different ports.

You can easily check the config files to see which version is on which port:

$ grep -H '^port' /etc/postgresql/*/main/postgresql.conf
/etc/postgresql/8.4/main/postgresql.conf:port = 5432
/etc/postgresql/8.3/main/postgresql.conf:port = 5433

Most of the PostGreSQL commands take the "-p ####" or "--port=####" option, so you can use that to select the version you want.


Use --cluster option e.g. (assuming that both clusters are named as default main):

psql --cluster 8.4/main
psql --cluster 9.0/main

Generic schemas are:

--cluster version/name      # for local connections
--cluster version/host:port # for TCP/IP connections

To list all installed clusters (name, port, status, data directory etc.) use pg_lsclusters command.

Check man pg_wrapper for more information.