Re: DB alias ?

From: Tim Uckun <timuckun(at)gmail(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: Shridhar Daithankar <ghodechhap(at)ghodechhap(dot)net>, pgsql-general <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: 2014-03-24 01:22:13
Message-ID: CAGuHJrMP55B+00dEWnQKiqEYWbv4HdAnchvxBQMiqtsX4L_7mw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

How can this be combined with other commands. For example pgsql doesn't
like this

psql service=test1 -d test_database -c "some command"

the PGSERVICE=test1 psql blah blah works but seems cumbersome. Why isn't
there a psql --service=blah option?

On Thu, Jan 24, 2013 at 9:48 PM, Guillaume Lelarge
<guillaume(at)lelarge(dot)info>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.
> > > >> 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(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
>
>
> --
> Guillaume
> http://blog.guillaume.lelarge.info
> http://www.dalibo.com
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-03-24 01:39:30 Re: DB alias ?
Previous Message Venkata Balaji Nagothi 2014-03-24 00:55:08 Re: Upgrading from 9.2 to 9.3 causes performance degradation