[FEISTY] How to run PostgreSQL v8.1 *and* v8.2

Asked by Uqbar

I need to work for a transition from v8.1 to v8.2 of PostgreSQL.
I've installed both and now they are running both, one on Unix socket 5432 and one on 5433.
Everytime I run psql I get v8.1.8 client attaching to v8.1.8 server.
I've tried to read some manual pages (postgresqlrc and user_clusters) as well as the package description.
But I still need some help.
Any hint?
Thanks a lot.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu postgresql-8.2 Edit question
Assignee:
No assignee Edit question
Solved by:
Uqbar
Solved:
Last query:
Last reply:
Revision history for this message
Uqbar (uqbar) said :
#1

The documentation says I should name the clusters.
I've no clue about what a cluster is and how to name it.
Please, I need at least some hint!
Thanks.

Revision history for this message
Markus Thielmann (thielmann) said :
#2

Try telling psql to which port you want to connect:

psql --port 5433

Revision history for this message
Best Uqbar (uqbar) said :
#3

It *almost* works:
--------
postgres$ psql --port 5433
Welcome to psql 8.1.8 (server 8.2.4), the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

WARNING: You are connected to a server with major version 8.2,
but your psql client is major version 8.1. Some backslash commands,
such as \d, might not work properly.
--------
As you can see the client being actually run is 8.1 against an 8.2 server. Which is not what I meant to do.
The correct answer here seems to be another.
The pg_wrapper man page suggests you to use a --cluster argument to define the cluster and the version you want
to connect to (not just psql but all other user tools like pg_dump).
The bad news is that there is no mention there about the "default cluster" being created with the postgresql
server installation.
The only hint is here:
/usr/share/doc/postgresql-8.2/README.Debian.gz
where the default cluster name appears: it's "main".
So the correct solution is:

--------
postgres$ psql --cluster 8.2/main template1
Welcome to psql 8.2.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit
--------

Many thanks!

Revision history for this message
Uqbar (uqbar) said :
#4

By the way, I just discovered that there is also a tool that will show
the active clusters in all running versions:

--------
postgres$ pg_lsclusters
Version Cluster Port Status Owner Data directory Log file
8.1 main 5432 online postgres /var/lib/postgresql/8.1/main /var/log/postgresql/postgresql-8.1-main.log
8.2 main 5433 online postgres /var/lib/postgresql/8.2/main /var/log/postgresql/postgresql-8.2-main.log
--------

The actual problem is with lack of (cross) references among the manpages.