Re: DB alias ?

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Guillaume Lelarge *EXTERN*" <guillaume(at)lelarge(dot)info>, "Shridhar Daithankar" <ghodechhap(at)ghodechhap(dot)net>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>, Rob Sargent <robjsargent(at)gmail(dot)com>
Subject: Re: DB alias ?
Date: 2013-01-24 09:44:00
Message-ID: A737B7A37273E048B164557ADEF4A58B0579EDC0@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Guillaume Lelarge wrote:
> On Thu, 2013-01-24 at 09:01 +0530, Shridhar Daithankar wrote:
> > On Wednesday, January 23, 2013 09:39:43 PM Gauthier, Dave wrote:
> > > Then someone who wants to look at old JAN data will have the same problem
> > > :-(
> > >
> > > If I recall, Oracle enables something like this. Multiple tnsfilenames (or
> > > something like that). There was a connect layer on the server side that
> > > the DBA had access to where you could do stuff like this.

> > I would have suggested to use pg_services file as documented at
> >
> > http://www.postgresql.org/docs/9.1/static/libpq-pgservice.html
> > http://www.postgresql.org/docs/9.1/static/libpq-connect.html
> >
> > You can think of this as tnsnames replacement.
> >
> > but I am unable to make it work. I don't know what is wrong with this.
> >
> > shridhar(at)bheem ~$ cat ~/.pg_service.conf
> > [test1]
> > host=localhost
> > dbname=test
> >
> > shridhar(at)bheem ~$ strace -o psql.strace psql test1
> > psql: FATAL: database "test1" does not exist
>
> Well, you need to tell psql to use a service:
>
> psql service=test1
>
> or
>
> PGSERVICE=test1
> psql

In addition, to return to the example from
http://www.postgresql.org/message-id/0AD01C53605506449BA127FB8B99E5E16112D04F@FMSMSX105.amr.corp.intel.com
you can centralize the name resolution on an LDAP server:
http://www.postgresql.org/docs/current/static/libpq-ldap.html

That saves you from having to change the pg_service.conf
file on each client if you have a lot of clients.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2013-01-24 09:53:16 Re: Jobs for a Oracle/Postgres DBAs in Australia
Previous Message Guillaume Lelarge 2013-01-24 08:48:54 Re: DB alias ?