Re: Understanding the behaviour of hostname in psql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marco Craveiro <marco(dot)craveiro(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Understanding the behaviour of hostname in psql
Date: 2010-12-05 17:03:11
Message-ID: 26365.1291568591@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Marco Craveiro <marco(dot)craveiro(at)gmail(dot)com> writes:
> unfortunately, the result is still not quite right:

> $ psql -h 127.0.0.1 -U marco -w --dbname sanzala
> [ works as expected ]

> $ psql -h localhost -U marco -w --dbname sanzala
> psql: fe_sendauth: no password supplied

It looks to me like "localhost" is getting resolved as the IPv6
loopback address (::1), which for some reason you've configured
differently than the IPv4 loopback address in your pg_hba.conf:

> host all all 127.0.0.1/32 trust
> host all all ::1/128 md5

I'm not sure why your "ping" example doesn't reflect that --- maybe you
have an IPv4-only version of ping? But if you're unconvinced you could
turn on log_connections and see where the server sees the connection as
coming from.

regards, tom lane

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tim 2010-12-05 17:20:55 C Function returning a tuple with a float4 array as column
Previous Message Marco Craveiro 2010-12-05 12:12:51 Re: Understanding the behaviour of hostname in psql