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

From Fujii Masao
Subject Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value
Date
Msg-id 464ea63f-9a73-4684-951e-a2cdf1bbcc24@oss.nttdata.com
Whole thread Raw
Responses Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value
List pgsql-hackers

On 2024/10/01 14:11, Yuto Sasaki (Fujitsu) wrote:
> Hi hackers,
> I've discovered a bug in ECPG that causes database connection failures. This issue
> appears to stem from libpq layer.
> Found bug: The EXEC SQL CONNECT TO statement fails to connect to the database.
> Specifically, the following code:
> ```c
> EXEC SQL CONNECT TO tcp:postgresql://localhost:5432/postgres?keepalives=1
> &keepalives_idle=1 USER yuto;
> ```
> When precompiled and executed, this code fails to connect to the database.
> Error message:
> ```
> failed: keepalives parameter must be an integer
> ```
> Steps to reproduce: The issue can be reproduced using the attached pgc file.
> Root cause: The method for parsing the keepalives parameter in the useKeepalives
> function of the libpq library is not appropriate. Specifically, it doesn't
> account for whitespace following the numeric value.

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.

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION




pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: pg_verifybackup: TAR format backup verification
Next
From: Tom Lane
Date:
Subject: Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value