Thread: .pgpass file and unix domain sockets

.pgpass file and unix domain sockets

From
Joachim Wieland
Date:
Since no decision has been reached in

http://archives.postgresql.org/pgsql-hackers/2006-05/msg00295.php

I send in the appended documentation patch to fix at least the
documentation. Personally I think that there is no need to invent a new
syntax since we can express everything already with the current one.


Joachim


Attachment

Re: .pgpass file and unix domain sockets

From
Tom Lane
Date:
Joachim Wieland <joe@mcknight.de> writes:
> I send in the appended documentation patch to fix at least the
> documentation.

This is wrong according to my tests.  "localhost" *does* work,
at least in some cases.

            regards, tom lane

Re: .pgpass file and unix domain sockets

From
Andrew Dunstan
Date:
Tom Lane wrote:
> Joachim Wieland <joe@mcknight.de> writes:
>
>> I send in the appended documentation patch to fix at least the
>> documentation.
>>
>
> This is wrong according to my tests.  "localhost" *does* work,
> at least in some cases.
>
>

As I understand it, the only case where it doesn't is where an explicit
host connection parameter pointing to the socket directory, or the same
via PGHOST, is used, Is that right?

cheers

andrew

Re: .pgpass file and unix domain sockets

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> This is wrong according to my tests.  "localhost" *does* work,
>> at least in some cases.

> As I understand it, the only case where it doesn't is where an explicit
> host connection parameter pointing to the socket directory, or the same
> via PGHOST, is used, Is that right?

Well, the point is that if you do that then you have to write that
socket directory as the hostname in .pgpass.  What was on the table for
discussion was whether we like that behavior as-is (in which case we'd
better document it), or whether we should make it match "localhost" in
all cases, or whether we should do some third thing.

Personally I wouldn't object to making it match "localhost" in all
cases.  That's what the documentation says, and the use-case for
doing something more complicated seems pretty thin.

            regards, tom lane

Re: .pgpass file and unix domain sockets

From
Andrew Dunstan
Date:
Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>
>> Tom Lane wrote:
>>
>>> This is wrong according to my tests.  "localhost" *does* work,
>>> at least in some cases.
>>>
>
>
>> As I understand it, the only case where it doesn't is where an explicit
>> host connection parameter pointing to the socket directory, or the same
>> via PGHOST, is used, Is that right?
>>
>
> Well, the point is that if you do that then you have to write that
> socket directory as the hostname in .pgpass.  What was on the table for
> discussion was whether we like that behavior as-is (in which case we'd
> better document it), or whether we should make it match "localhost" in
> all cases, or whether we should do some third thing.
>
> Personally I wouldn't object to making it match "localhost" in all
> cases.  That's what the documentation says, and the use-case for
> doing something more complicated seems pretty thin.
>
>
>

I almost agree. If anything, I'd prefer to provide for an explicit entry
covering all Unix Domain sockets - it took me by some surprise to find a
while back that "localhost" covers that case - it seems a mismatch with
how pg_hba.conf works.

cheers

andrew


Re: .pgpass file and unix domain sockets

From
Tom Lane
Date:
Andrew Dunstan <andrew@dunslane.net> writes:
> Tom Lane wrote:
>> Personally I wouldn't object to making it match "localhost" in all
>> cases.  That's what the documentation says, and the use-case for
>> doing something more complicated seems pretty thin.

> I almost agree. If anything, I'd prefer to provide for an explicit entry
> covering all Unix Domain sockets - it took me by some surprise to find a
> while back that "localhost" covers that case - it seems a mismatch with
> how pg_hba.conf works.

Well, that'd break existing .pgpass files (unless we match localhost
too, which seems to defeat the purpose).  But maybe it's worth doing
for consistency's sake.  I think we should bring it up on a more
widely read list than -patches if you want to propose a
non-backwards-compatible change ...

            regards, tom lane

Re: .pgpass file and unix domain sockets

From
Joachim Wieland
Date:
On Tue, May 16, 2006 at 09:43:42AM -0400, Tom Lane wrote:
> Joachim Wieland <joe@mcknight.de> writes:
> > I send in the appended documentation patch to fix at least the
> > documentation.

> This is wrong according to my tests.  "localhost" *does* work,
> at least in some cases.

I see the problem now... I got confused by the debian package. There, psql
is a wrapper that explicitly sets environment variables including
PGHOST and then calls `the real' psql...

So you're clearly right, the problem is less severe than I thought. Sorry
for the noise.


Joachim