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

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: PQHost() undefined behavior if connecting string contains both host and hostaddr types
Date: 2018-03-27 00:43:27
Message-ID: CAJrrPGf2X3OviKA1Zot81eaFkViPicG12Gc-fOObsPhZbnwTEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 27, 2018 at 12:23 AM, Michael Paquier <michael(at)paquier(dot)xyz>
wrote:

> On Mon, Mar 26, 2018 at 11:39:51PM +1100, Haribabu Kommi wrote:
> > And if we are not going to change the above, then PQhost() function
> > returns 3 values,
> > - NULL when the conn==NULL
> > - Actual host or hostaddr of the active connection
> > - Empty string when the conn is not able to evaluate.
> >
> > Is it fine to proceed like above?
>
> Yeah, I would think that this is a sensible approach. Keeping
> consistent with NULL is good for the other function, and we still need a
> way to identify the dont-know state. Peter, what's your input on that?
>

Patch attached with the above behavior along with other comments from
upthread.

Regards,
Hari Babu
Fujitsu Australia

Attachment Content-Type Size
PQhost-to-return-active-connected-host-and-hostaddr_v6.patch application/octet-stream 4.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Samokhvalov 2018-03-27 00:44:49 Re: idea - custom menu
Previous Message Andrew Dunstan 2018-03-27 00:39:37 Re: ppc64le support in 9.3 branch?