Re: PQHost() undefined behavior if connecting string contains bothhost and hostaddr types

Поиск
Список
Период
Сортировка
Искать
От
Peter Eisentraut
Тема
Re: PQHost() undefined behavior if connecting string contains bothhost and hostaddr types
Дата
Msg-id
6efa866c-84a1-d83e-db21-5d251303e437@2ndquadrant.com
Ответ на
Список
Дерево обсуждения
PQHost() undefined behavior if connecting string contains both hostand hostaddr types Haribabu Kommi <kommi.haribabu@gmail.com>
Re: PQHost() undefined behavior if connecting string contains bothhost and hostaddr types Michael Paquier <michael.paquier@gmail.com>
Re: PQHost() undefined behavior if connecting string contains bothhost and hostaddr types Haribabu Kommi <kommi.haribabu@gmail.com>
Re: PQHost() undefined behavior if connecting string contains bothhost and hostaddr types Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Re: PQHost() undefined behavior if connecting string contains bothhost and hostaddr types Michael Paquier <michael@paquier.xyz>
Re: PQHost() undefined behavior if connecting string contains bothhost and hostaddr types Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
On 3/21/18 03:40, Michael Paquier wrote:
>>> Moreover, I wonder whether we shouldn't remove the branch where
>>> conn->connhost is NULL.  When would that be the case?  The current
>>> behavior is to sometimes return the actual host connected to, and
>>> sometimes the host list.  That doesn't make sense.
>> Scenarios where the connection is not yet established, in that scenario
>> the PQhost() can return the provided connection host information.
>>
>> Other than the above, it always returns the proper host details.
> That remark is from me upthread.  In the case of a non-established
> connection, I think that we ought to return that.

So, if the connection object is NULL, PQhost() returns NULL.  While the
connection is being established (whatever that means), it returns
whatever was specified as host.  And when the connection is established,
it returns the host actually connected to.  That seems pretty crazy.  It
should do only one or the other.  Especially since there is, AFAICT, no
way to know at run time whether the value it returned just then is one
or the other.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

В списке pgsql-hackers по дате отправления
От: Peter Eisentraut
Дата:
От: Tom Lane
Дата:
FAQ