Re: DB alias ? - Mailing list pgsql-general

From Albe Laurenz
Subject Re: DB alias ?
Date
Msg-id A737B7A37273E048B164557ADEF4A58B0579F204@ntex2010a.host.magwien.gv.at
Whole thread Raw
In response to Re: DB alias ?  ("Gauthier, Dave" <dave.gauthier@intel.com>)
List pgsql-general
Dave Gauthier wrote:
> 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

That's wrong.  It should have been
  psql "service=test1"
as has been pointed out.

> psql: FATAL: database "test1" does not exist
>
> shridhar@bheem ~$ grep -i pg_service psql.strace
>
> shridhar@bheem ~$ psql test
> psql (9.2.2)
> Type "help" for help.
>
> test=# \q
>
> shridhar@bheem ~$ psql --version
> psql (PostgreSQL) 9.2.2

> The services file looked/looks interesting, but there are far too many clients, and at multiple sites,
> to manage this.  I really need something on the server side, a single place to manage this for all
> connections regardless of where they are coming from.  It also looks like a C lib based file,
> something I won't have access to except, maybe, through an app designed for DBAs to edit this file.
> If I am mistaken, and the services file is in the DB root area (the area specified after the "-D" in
> commands like pg_ctl), then maybe this is still viable.  But I don't see a services file there :-(

The service file is on the client side.

In a scenario like yours, use LDAP lookup:
http://www.postgresql.org/docs/current/static/libpq-ldap.html

Yours,
Laurenz Albe


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


pgsql-general by date:

Previous
From: Stefan Froehlich
Date:
Subject: How to identify the source of a deadlock?
Next
From: Albe Laurenz
Date:
Subject: Re: How to identify the source of a deadlock?