Re: fix psql \conninfo & \connect when using hostaddr

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: fix psql \conninfo & \connect when using hostaddr
Дата
Msg-id 20181119155315.vsrgj2droozqgfqo@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: fix psql \conninfo & \connect when using hostaddr  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: fix psql \conninfo & \connect when using hostaddr  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: fix psql \conninfo & \connect when using hostaddr  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: fix psql \conninfo & \connect when using hostaddr  (Noah Misch <noah@leadboat.com>)
Список pgsql-hackers
On 2018-Nov-17, Fabien COELHO wrote:

> Here is the updated v2
> 
>  - libpq internal function getHostaddr get a length,
>    and I added an assert about it.
>  - added a few braces on if/if/else/if/else/else
>  - added an UNKNOWN_HOST macro to hide "???"
>  - moved host_addr[] declaration earlier to avoid some braces

You forgot to free(conn->connip) during freePGconn().

I found the UNKNOWN_HOST business quite dubious -- not only in your
patch but also in the existing coding.  I changed the getHostname API so
that instead of returning "???" it sets the output buffer to the empty
string.  AFAICS the only user-visible behavior is that we no longer
display the "???" in a parenthical comment next to the server address
when a connection fails (this is pre-existing behavior, not changed by
your patch.)

Now, maybe the thinking was that upon seeing this message:

could not connect to server: some error here
Is the server running on host "pg.mines-paristech.fr" (???) and accepting
connections on port 5432?

the user was going to think "oh, my machine must have run out of memory,
I'll reboot and retry".  However, I highly doubt that anybody would
reach that conclusion without reading the source code.  So I deem this
useless.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: your mail
Следующее
От: Dmitry Dolgov
Дата:
Сообщение: Re: Reviving the "Stopping logical replication protocol" patch fromVladimir Gordichuk