Re: default database selector

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org, dave(dot)potts(at)pinan(dot)co(dot)uk
Subject: Re: default database selector
Date: 2012-02-07 14:49:01
Message-ID: 201202070649.01948.adrian.klaver@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(dot)klaver(at)gmail(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2012-02-07 14:53:27 Re: Error while importing CSV file
Previous Message Alban Hertroys 2012-02-07 14:45:06 Re: How to write in Postgres