Re: DB alias ?

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Gauthier, Dave *EXTERN*" <dave(dot)gauthier(at)intel(dot)com>, Shridhar Daithankar <ghodechhap(at)ghodechhap(dot)net>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Cc: Rob Sargent <robjsargent(at)gmail(dot)com>
Subject: Re: DB alias ?
Date: 2013-01-24 15:26:11
Message-ID: A737B7A37273E048B164557ADEF4A58B0579F204@ntex2010a.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)bheem ~$ cat ~/.pg_service.conf
> [test1]
> host=localhost
> dbname=test
>
> shridhar(at)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(at)bheem ~$ grep -i pg_service psql.strace
>
> shridhar(at)bheem ~$ psql test
> psql (9.2.2)
> Type "help" for help.
>
> test=# \q
>
> shridhar(at)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2013-01-24 15:28:43 Re: How to identify the source of a deadlock?
Previous Message Stefan Froehlich 2013-01-24 15:07:04 How to identify the source of a deadlock?