psql needs an option to set hostaddr instead of host - Mailing list pgsql-bugs

From Aaron Hillegass
Subject psql needs an option to set hostaddr instead of host
Date
Msg-id C9DE2AF0-D016-11D5-916A-003065BF8DAA@bignerdranch.com
Whole thread Raw
List pgsql-bugs
In the past,  I've always used hostnames or host addresses with the -h
option on psql:

 > psql -h mycomputer mydata rex

or

 > psql -h 192.168.168.52 mydata rex

It turns out that this use of the IP address only works if DNS is set up
correctly.

We recently installed postgres on a network without DNS.  We could
ping,  but we couldn't connect with psql when we supplied the IP address
as the host:

 > psql -h 192.168.168.52 mydata rex
psql: connectDBStart() -- unknown hostname: 192.168.168.52

(You can reproduce this on your network.  Kill named,  and you will be
able to ping,  but not connect with psql.)

I've looked at the source a bit,  and realized that I really needed to
set the hostaddr option in the connect string,  but that there is no way
to do this in psql.  I think there should be another option on psql:

 > psql -i 192.168.168.52 mydata rex

Or,  you could simply add an option to allow the user to send any part
ot the connect string:

 > psql -C hostaddr=192.168.168.52 -C port=593 -C dbname=mydata -C
user=rex"

(Note that this last option would also take care of the "add requiressl
option or not" question.)

- Aaron Hillegass

The Big Nerd Ranch
Intensive classes for programmers
http://www.bignerdranch.com/
(404) 210-5663

pgsql-bugs by date:

Previous
From: Michael Meskes
Date:
Subject: Re: recent ECPG 7.1->7.2 incompatibility ( interval('0sec') = syntax error )
Next
From: 畠中 晃弘
Date:
Subject: JDBC driver bug?? (setBinaryStream)