pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgpass hostname and IP address
5+ messages / 3 participants
[nested] [flat]

* pgpass hostname and IP address
@ 2018-03-10 04:19  Ron Johnson <ron.l.johnson@cox.net>
  0 siblings, 4 replies; 5+ messages in thread

From: Ron Johnson @ 2018-03-10 04:19 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

(8.4 and 9.2, but soon to 9.6)

If we sometimes access a db server by IP address, and sometimes by hostname, 
must we have two entries for each server+user (one with the hostname and the 
other with IP address), or is there a way to put them both on the same line?

-- 
Angular momentum makes the world go 'round.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgpass hostname and IP address
@ 2018-03-10 04:26  David G. Johnston <david.g.johnston@gmail.com>
  parent: Ron Johnson <ron.l.johnson@cox.net>
  3 siblings, 0 replies; 5+ messages in thread

From: David G. Johnston @ 2018-03-10 04:26 UTC (permalink / raw)
  To: Ron Johnson <ron.l.johnson@cox.net>; +Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

On Friday, March 9, 2018, Ron Johnson <ron.l.johnson@cox.net> wrote:

> (8.4 and 9.2, but soon to 9.6)
>
> If we sometimes access a db server by IP address, and sometimes by
> hostname, must we have two entries for each server+user (one with the
> hostname and the other with IP address), or is there a way to put them both
> on the same lin
>

 https://www.postgresql.org/docs/10/static/libpq-pgpass.html

So unless you can make a wildcard work you are stuck with two separate
lines.

David J.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgpass hostname and IP address
@ 2018-03-10 04:34  Ron Johnson <ron.l.johnson@cox.net>
  parent: Ron Johnson <ron.l.johnson@cox.net>
  3 siblings, 0 replies; 5+ messages in thread

From: Ron Johnson @ 2018-03-10 04:34 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 03/09/2018 10:26 PM, David G. Johnston wrote:
> On Friday, March 9, 2018, Ron Johnson <ron.l.johnson@cox.net 
> <mailto:ron.l.johnson@cox.net>> wrote:
>
>     (8.4 and 9.2, but soon to 9.6)
>
>     If we sometimes access a db server by IP address, and sometimes by
>     hostname, must we have two entries for each server+user (one with the
>     hostname and the other with IP address), or is there a way to put them
>     both on the same lin
>
>
> https://www.postgresql.org/docs/10/static/libpq-pgpass.html
>
> So unless you can make a wildcard work you are stuck with two separate lines.

Yeah, I read that (well, the ones for my ancient versions), but hoped there 
might be something I missed, or some obscure and clever trick.

-- 
Angular momentum makes the world go 'round.

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgpass hostname and IP address
@ 2018-03-10 05:11  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Ron Johnson <ron.l.johnson@cox.net>
  3 siblings, 0 replies; 5+ messages in thread

From: Adrian Klaver @ 2018-03-10 05:11 UTC (permalink / raw)
  To: Ron Johnson <ron.l.johnson@cox.net>; pgsql-general@lists.postgresql.org

On 03/09/2018 08:19 PM, Ron Johnson wrote:
> (8.4 and 9.2, but soon to 9.6)
> 
> If we sometimes access a db server by IP address, and sometimes by 
> hostname, must we have two entries for each server+user (one with the 
> hostname and the other with IP address), or is there a way to put them 
> both on the same line?
> 

Not with .pgpass, though there is the service file method:

https://www.postgresql.org/docs/9.6/static/libpq-pgservice.html

https://www.postgresql.org/docs/10/static/libpq-connect.html#LIBPQ-CONNSTRING

service

     Service name to use for additional parameters. It specifies a 
service name in pg_service.conf that holds additional connection 
parameters. This allows applications to specify only a service name so 
connection parameters can be centrally maintained. See Section 33.16.



-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgpass hostname and IP address
@ 2018-03-10 06:17  Ron Johnson <ron.l.johnson@cox.net>
  parent: Ron Johnson <ron.l.johnson@cox.net>
  3 siblings, 0 replies; 5+ messages in thread

From: Ron Johnson @ 2018-03-10 06:17 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

On 03/09/2018 11:11 PM, Adrian Klaver wrote:
> On 03/09/2018 08:19 PM, Ron Johnson wrote:
>> (8.4 and 9.2, but soon to 9.6)
>>
>> If we sometimes access a db server by IP address, and sometimes by 
>> hostname, must we have two entries for each server+user (one with the 
>> hostname and the other with IP address), or is there a way to put them 
>> both on the same line?
>>
>
> Not with .pgpass, though there is the service file method:
>
> https://www.postgresql.org/docs/9.6/static/libpq-pgservice.html
>
> https://www.postgresql.org/docs/10/static/libpq-connect.html#LIBPQ-CONNSTRING
>
> service
>
>     Service name to use for additional parameters. It specifies a service 
> name in pg_service.conf that holds additional connection parameters. This 
> allows applications to specify only a service name so connection 
> parameters can be centrally maintained. See Section 33.16.

That looks promising.

-- 
Angular momentum makes the world go 'round.




^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2018-03-10 06:17 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-10 04:19 pgpass hostname and IP address Ron Johnson <ron.l.johnson@cox.net>
2018-03-10 04:26 ` David G. Johnston <david.g.johnston@gmail.com>
2018-03-10 04:34 ` Ron Johnson <ron.l.johnson@cox.net>
2018-03-10 05:11 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-03-10 06:17 ` Ron Johnson <ron.l.johnson@cox.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox