localhost in pgpass file?

Поиск
Список
Период
Сортировка
Искать

localhost in pgpass file?

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:

Can anyone explain to me why 'localhost' in a .pgpass file matches both 
a Unix socket and a tcp localhost connection?

Also, there is no documentation at all that I can see to cover the Unix 
socket case. I found the information after much looking through asking 
on IRC, where luckily Andrew@Supnews knew the answer.


cheers

andrew

Re: localhost in pgpass file?

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:


Andrew Dunstan wrote:

>
> Can anyone explain to me why 'localhost' in a .pgpass file matches 
> both a Unix socket and a tcp localhost connection?
>
> Also, there is no documentation at all that I can see to cover the 
> Unix socket case. I found the information after much looking through 
> asking on IRC, where luckily Andrew@Supnews knew the answer.


Nobody answered (or maybe cared? :-) )

I propose to document the slightly odd behaviour with this wording:
The literal value localhost in the hostname field 
matchesan empty hostname connection parameter as well as matching its literal 
value.This can be useful for specifying Unix-domain socket connections.

cheers

andrew


>

Re: localhost in pgpass file?

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Andrew Dunstan wrote:
> 
> 
> Andrew Dunstan wrote:
> 
> >
> > Can anyone explain to me why 'localhost' in a .pgpass file matches 
> > both a Unix socket and a tcp localhost connection?
> >
> > Also, there is no documentation at all that I can see to cover the 
> > Unix socket case. I found the information after much looking through 
> > asking on IRC, where luckily Andrew@Supnews knew the answer.
> 
> 
> Nobody answered (or maybe cared? :-) )
> 
> I propose to document the slightly odd behaviour with this wording:
> 
>  The literal value localhost in the hostname field 
> matches
>  an empty hostname connection parameter as well as matching its literal 
> value.
>  This can be useful for specifying Unix-domain socket connections.

Added to docs:
A hostname of localhost</> matches both host</> (TCP)and local</> (Unix domain socket) connections coming from thelocal machine.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610) 359-1001 +  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

FAQ