Home > Archive > PostgreSQL Hacks > October 2005 > localhost in pgpass file?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author localhost in pgpass file?
Andrew Dunstan

2005-10-27, 8:14 am


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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql
.org so that your
message can get through to the mailing list cleanly

Andrew Dunstan

2005-10-27, 9:26 am



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 <literal>localhost</literal> 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.

cheers

andrew


>


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Bruce Momjian

2005-10-27, 9:26 am

Andrew Dunstan wrote:
>
>
> Andrew Dunstan wrote:
>
>
>
> Nobody answered (or maybe cared? :-) )
>
> I propose to document the slightly odd behaviour with this wording:
>
> The literal value <literal>localhost</literal> 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 <literal>localhost</> matches both <literal>host</> (TCP)
and <literal>local</> (Unix domain socket) connections coming from the
local 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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com