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

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: fix psql \conninfo & \connect when using hostaddr
Дата
Msg-id alpine.DEB.2.21.1906121430280.13288@lancre
обсуждение исходный текст
Ответ на 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
Hello,

> I got that. I'm working on it, and on the other issues you raised.
>
> The issue I see is what do we want when a name resolves to multiple 
> addresses. The answer is not fully obvious to me right now. I'll try to send 
> a patch over the week-end.

At Alvaro's request, here is a quick WIP patch, that does not do the right 
thing, because there is no simple way to know whether hostaddr was set at 
the libPQ level, so either we set it always, about which Noah complained, 
or we don't, about which someone else will complain quite easily, i.e. 
with this patch

   \c "host=foo hostaddr=ip"

connects to ip, but then

   \c

will reconnect to foo but ignore ip. Well, ISTM that this is back to the 
previous doubtful behavior, so at least it is not a regression, just the 
same bug:-)

A solution could be to have a PQdoestheconnectionuseshostaddr(conn) 
function, but I cannot say I'd be thrilled.

Another option would be to import PGconn full definition in 
"psql/command.c", but that would break the PQ interface, I cannot say I'd 
be thrilled either.

The patch returns host as defined by the user, but the regenerated 
hostaddr (aka connip), which is not an homogeneous behavior. PQhost should 
probably use connip if host was set as an ip, but that needs guessing.

The underlying issue is that the host/hostaddr stuff is not that easy to 
fix.

At least, after the patch the connection information (\conninfo) is still 
the right one, which is an improvement.

-- 
Fabien.
Вложения

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

Предыдущее
От: Kuntal Ghosh
Дата:
Сообщение: Re: Adaptive query optimization
Следующее
От: tushar
Дата:
Сообщение: Re: [pg_rewind] cp: cannot stat ‘pg_wal/RECOVERYHISTORY’: No such file or directory