Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value
Date
Msg-id 148583.1727905171@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value  (Fujii Masao <masao.fujii@oss.nttdata.com>)
List pgsql-hackers
Fujii Masao <masao.fujii@oss.nttdata.com> writes:
> On 2024/10/02 11:35, Michael Paquier wrote:
>> On Tue, Oct 01, 2024 at 12:29:15PM -0400, Tom Lane wrote:
>>> I agree with Sasaki-san that useKeepalives seems rather bogus: almost
>>> every other place in fe-connect.c uses pqParseIntParam rather than
>>> calling strtol directly, so why not this one?

> I have no objection to improving the handling of the keepalives parameter.
> OTOH, I think ecpg might have an issue when converting the connection URI.

I went ahead and pushed Sasaki-san's patch.  I think anything we might
do in ecpg is probably just cosmetic and wouldn't get back-patched.

> In the converted URI, whitespace is added before and after the ? character.
> In my quick test, ECPGconnect() seems to handle this without error,
> but when I tried the same URI in psql, it returned an error:
> $ psql "postgresql://localhost:5432/postgres?keepalives=1 & keepalives_idle=1 & keepalives_interval=1 &
keepalives_count=2"
> psql: error: invalid URI query parameter: " keepalives_idle"

Interesting.  This is unhappy about the space before a parameter name,
not the space after a parameter value, so it's a different issue.
But it's weird that ecpg takes it while libpq doesn't.  Could libecpg
be modifying/reassembling the URI string?  I didn't look.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Alena Rybakina
Date:
Subject: Re: On disable_cost
Next
From: David Rowley
Date:
Subject: Re: On disable_cost