Thread: default database selector
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. --
On Monday, February 06, 2012 10:31:51 pm Dave Potts wrote: > 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. > > Dave. -- Adrian Klaver adrian.klaver@gmail.com
On 2012-02-07, Dave Potts <dave.potts@pinan.co.uk> wrote: > > > 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