Discussion:
default database selector
Dave Potts
2012-02-07 06:31:51 UTC
Permalink
I am running Ubuntu 11.04, I have Postgres 8.4 and 9.1 installed.

My default when I say psql it connects to postgres 8.4

ie I set export PGCLUSTER=9.1/main

it connects to 9.1

Q. How can I connect to 9.1 by default without having to set PGCLUSTER?

I looked in /etc/postgresql-common, there did not seem to be anything
obivious in there for which version to use.

Dave.
--
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Adrian Klaver
2012-02-07 14:49:01 UTC
Permalink
Post by Dave Potts
I am running Ubuntu 11.04, I have Postgres 8.4 and 9.1 installed.
My default when I say psql it connects to postgres 8.4
ie I set export PGCLUSTER=9.1/main
it connects to 9.1
Q. How can I connect to 9.1 by default without having to set PGCLUSTER?
I looked in /etc/postgresql-common, there did not seem to be anything
obivious in there for which version to use.
http://man.flashnux.com/en/debian/6/6.0.2/man7/postgresql-common.7.html
From here it would seem there several options beside using PGCLUSTER.
You could set up a user ~/.postgresqlrc file
or
a system wide /etc/postgresql−common/user_clusters where
"
/etc/postgresql−common/user_clusters

stores the default cluster and database for users and groups as set by the
administrators.
"
In either case I am not sure the above will help with you PHP problem. The
cluster option seems to be specific the pg_wrapper program and lives a layer
above that which PHP is using to connect. The PHP issue may solved however by
using a service file:
http://www.postgresql.org/docs/9.0/interactive/libpq-pgservice.html

Basically a way to group connection parameters for a particular server.

The other way would be to specify the connection parameters directly in the
connection string and not using the --cluster option. In your case that would
probably be just a matter of naming different ports for the 8.4 and 9.1 databases
respectively.
Post by Dave Potts
Dave.
--
Adrian Klaver
***@gmail.com
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Jasen Betts
2012-02-11 08:19:45 UTC
Permalink
Post by Dave Potts
I am running Ubuntu 11.04, I have Postgres 8.4 and 9.1 installed.
My default when I say psql it connects to postgres 8.4
ie I set export PGCLUSTER=9.1/main
it connects to 9.1
Q. How can I connect to 9.1 by default without having to set PGCLUSTER?
I looked in /etc/postgresql-common, there did not seem to be anything
obivious in there for which version to use.
man 7 postgresql-common
--
⚂⚃ 100% natural
--
Sent via pgsql-general mailing list (pgsql-***@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Continue reading on narkive:
Loading...