psql needs an option to set hostaddr instead of host
psql needs an option to set hostaddr instead of host
От:
Aaron Hillegass <aaron@bignerdranch.com>
Дата:
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