Re: default database selector - Mailing list pgsql-general

From Adrian Klaver
Subject Re: default database selector
Date
Msg-id 201202070649.01948.adrian.klaver@gmail.com
Whole thread Raw
In response to default database selector  ("Dave Potts" <dave.potts@pinan.co.uk>)
List 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.klaver@gmail.com

pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: How to write in Postgres
Next
From: Adrian Klaver
Date:
Subject: Re: Error while importing CSV file