I have 2 different versions of PostgreSQL installed on my system (Ubuntu Lucid):

  • /var/lib/postgresql/8.4
  • /var/lib/postgresql/9.0

By default, when I run a PostgreSQL command such as createdb or psql, the 9.0 version is used.

How do I configure my system to use the 8.4 version by default instead?

link|improve this question

62% accept rate
feedback

2 Answers

The various PostgreSQL command line tools will talk to the server listening on the default port (5432) by default.

You can determine which port each server is listening on by looking for the port variable in the /etc/postgresql/$VERSION/main/postgresql.conf file for the relevant server.

To get the command line tools to talk to the other server by default, you have two options:

First, you could switch the ports the two servers are listening on by editing the previously mentioned configuration files and then restarting both servers (you'll probably want to stop each one before starting either).

Alternatively, you can set the PGPORT environment variable to the port number of the desired default server. That should affect all applications using the PostgreSQL client library.

link|improve this answer
feedback

With regards setting up new users via de CLI, how does one create new users if doing

sudo su postgres

takes me to the default install which in lucid is 8.4.

Is there a way to create a new user under 9.1 via cli?

link|improve this answer
Please ask this as a new question by clicking the Ask Question button on the top right of the page. – Jorge Castro Dec 5 '11 at 15:52
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.