Re: Problem connecting to postgres - Mailing list pgsql-general

From Tom Lane
Subject Re: Problem connecting to postgres
Date
Msg-id 25654.988323527@sss.pgh.pa.us
Whole thread Raw
In response to Problem connecting to postgres  ("solo" <solo@zoot.dnsalias.net>)
List pgsql-general
"solo" <solo@zoot.dnsalias.net> writes:
> If i use the -h option to specify the hostname it always fails to connect.

> [solo@zoot /root]$ psql -h localhost
> Connection to database 'solo' failed.
> connectDB() --  unknown hostname: localhost

> My localhost is configured properly

> [root@zoot /root]# ping -c 1 localhost
> PING localhost.dnsalias.net (127.0.0.1) from 127.0.0.1 : 56(84) bytes of
> data.
> 64 bytes from localhost (127.0.0.1): icmp_seq=0 ttl=255 time=0.3 ms

Hm.  It would seem that your psql is linked with a broken resolver
library (or at least a different one than ping is using --- it might
be looking at /etc/hosts instead of DNS, or vice versa).

Since you haven't told us anything about your platform or how you
built/obtained psql, it's impossible to say more than that.

            regards, tom lane

pgsql-general by date:

Previous
From: "Thomas F. O'Connell"
Date:
Subject: creating constants in postgres
Next
From: Doug McNaught
Date:
Subject: Re: JDBC speed question.