Re: DB alias ? - Mailing list pgsql-general

From Guillaume Lelarge
Subject Re: DB alias ?
Date
Msg-id 1359017334.1983.9.camel@localhost.localdomain
Whole thread Raw
In response to Re: DB alias ?  (Shridhar Daithankar <ghodechhap@ghodechhap.net>)
Responses Re: DB alias ?
Re: DB alias ?
List pgsql-general
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.
> > >> proposed new SQL command:
> > >>READ USERS MIND;
> > :
> > :-)
> >
> > Actually, read the DBA's mind.
> >
> > How about...
> >
> > postgres=# create db_alias FEB to db JAN;
> > postgres=# drop db_alias FEB;
>
> 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@bheem ~$ cat ~/.pg_service.conf
> [test1]
> host=localhost
> dbname=test
>
> shridhar@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


--
Guillaume
http://blog.guillaume.lelarge.info
http://www.dalibo.com



pgsql-general by date:

Previous
From: Cameron Shorter
Date:
Subject: Jobs for a Oracle/Postgres DBAs in Australia
Next
From: Albe Laurenz
Date:
Subject: Re: DB alias ?