The documentation for the .pgpass file seems to be incorrect with respect to
unix domain sockets.
There's also a user comment saying that:
http://www.postgresql.org/docs/8.1/interactive/libpq-pgpass.html
The documentation suggests that the hostname part of .pgpass can be set to
"localhost" to allow for automatic unix domain socket authentication. This
doesn't seem to work. Instead you have to set the directory of the socket as
the hostname part.
If this was never supposed to actually work as described, I'll submit a doc
patch that also explains in more detail how to use .pgpass for unix sockets.
Joachim