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



Reply via email to