psql needs an option to set hostaddr instead of host

From: Aaron Hillegass <aaron(at)bignerdranch(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: psql needs an option to set hostaddr instead of host
Date: 2001-11-03 04:53:57
Message-ID: C9DE2AF0-D016-11D5-916A-003065BF8DAA@bignerdranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2001-11-03 15:07:10 Bug #507: Granting insert on a table does not grant update to the ralated sequence
Previous Message herolin116 2001-11-03 03:30:44 The data of pg_dump has cr/lf character....