W/out specifying a -h switch, postgres defaults to using a UNIX domain
socket, meaning AF_UNIX and not AF_INET. There is a big difference.
Using -h 127.0.0.1 is the localhost not necessarily 'local' from the
context of postgres. W/out looking into the details, I think 'local' is
referring to AF_UNIX. In other words, without specyfing the -h switch,
when you have connected, do a "netstat -an" you'll see there are no
TCP/IP(AF_INET) sockets connected, but rather there is a AF_UNIX socket
connected which will be somewhere in /tmp/blah.s.psostgres.5000 or
something similar.
On Thu, 31 May 2007, Oliver Elphick wrote:
> On Thu, 2007-05-31 at 09:38 -0400, Bhavana.Rakesh wrote:
>> Hi,
>> Here's what happens when I specify the port number
>>
>> [brakesh@lnx383 ~]$ psql -U brakesh -p 5000 -h 127.0.0.1 -d testing123
>> psql: could not connect to server: Connection refused
>> Is the server running on host "127.0.0.1" and accepting
>> TCP/IP connections on port 5000?
>
> Since that command without "-h 127.0.0.1" does work, the clear
> implication is that somehow there is a postmaster listening on port 5000
> to Unix sockets and a different postmaster, presumably with a different
> pg_hba.conf, listening on port 5432 on 127.0.0.1.
>
>
>
--
Louis Gonzales
louis.gonzales@linuxlouis.net
http://www.linuxlouis.net