Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, "Yuto Sasaki (Fujitsu)" <sasaki(dot)yuto-00(at)fujitsu(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value
Date: 2024-10-02 02:35:19
Message-ID: ZvyxZxv0nvw_Vwv9@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Oct 01, 2024 at 12:29:15PM -0400, Tom Lane wrote:
> Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> writes:
>> Is a connection URL with whitespace, like "tcp:postgresql://localhost:5432/postgres?keepalives=1 & ...",
>> considered valid? If not, the issue seems to be that ecpg adds unnecessary whitespace
>> to the connection URL, especially after the "&" character.
>
> 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?

Yes, it is a mistake to not use pqParseIntParam(), or
parse_int_param() depending on the branch. This stuff has been
introduced by 4f4061b2dde1, where I've spent some time making sure
that leading and trailing whitespaces are discarded in this routine.

See also these examples where whitespaces are OK in a connection URL:
https://www.postgresql.org/message-id/20191021024020.GF1542%40paquier.xyz
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-10-02 02:36:35 Re: Requiring LLVM 14+ in PostgreSQL 18
Previous Message Michael Paquier 2024-10-02 02:28:26 Re: Call rm_redo in a temporary memory context