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

2024-10-07 Thread Michael Paquier
On Tue, Oct 08, 2024 at 01:19:59AM +0900, Fujii Masao wrote: > Commit 430ce189fc45 unexpectedly caused psql to report the error > "error: trailing data found" when a connection URI contains > a whitespace, e.g., in a parameter value. For example, > the following command used to work but no longer d

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

2024-10-07 Thread Fujii Masao
On 2024/10/06 18:35, Michael Paquier wrote: On Thu, Oct 03, 2024 at 08:12:28PM -0400, Tom Lane wrote: OK, if there's no objections let's push both remaining patches to HEAD only. Done as of f22e84df1dea and 430ce189fc45. Commit 430ce189fc45 unexpectedly caused psql to report the error "er

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

2024-10-06 Thread Michael Paquier
On Thu, Oct 03, 2024 at 08:12:28PM -0400, Tom Lane wrote: > OK, if there's no objections let's push both remaining patches > to HEAD only. Done as of f22e84df1dea and 430ce189fc45. -- Michael signature.asc Description: PGP signature

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

2024-10-04 Thread Yuto Sasaki (Fujitsu)
ne Cc: Fujii Masao; Sasaki, Yuto/佐佐木 悠人; pgsql-hackers@lists.postgresql.org 件名: Re: [BUG FIX]Connection fails with whitespace after keepalives parameter value On Wed, Oct 02, 2024 at 05:39:31PM -0400, Tom Lane wrote: > Interesting. This is unhappy about the space before a parameter name, > no

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

2024-10-03 Thread Michael Paquier
On Thu, Oct 03, 2024 at 08:12:28PM -0400, Tom Lane wrote: > OK, if there's no objections let's push both remaining patches > to HEAD only. WFM. -- Michael signature.asc Description: PGP signature

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

2024-10-03 Thread Tom Lane
Michael Paquier writes: > On Thu, Oct 03, 2024 at 11:57:16AM -0400, Tom Lane wrote: >> I don't have a strong opinion one way or the other about whether >> we should make libpq permissive about extra spaces (as per >> Michael's patch). I guess you could argue that all of these >> fixes are consist

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

2024-10-03 Thread Michael Paquier
On Thu, Oct 03, 2024 at 11:57:16AM -0400, Tom Lane wrote: > I don't have a strong opinion one way or the other about whether > we should make libpq permissive about extra spaces (as per > Michael's patch). I guess you could argue that all of these > fixes are consistent with the principle of "be c

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

2024-10-03 Thread Tom Lane
I poked into the ecpg end of this and found that the extra space is coming from one production in ecpg.trailer that's carelessly using cat_str (which inserts spaces) instead of makeN_str (which doesn't). So it's pretty trivial to fix, as attached. I do not think we could rip out ECPGconnect's log

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

2024-10-02 Thread Michael Paquier
On Wed, Oct 02, 2024 at 05:39:31PM -0400, Tom Lane wrote: > Interesting. This is unhappy about the space before a parameter name, > not the space after a parameter value, so it's a different issue. conninfo_uri_parse_options() parses the URI as a set of option/values, where conninfo_uri_parse_par

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

2024-10-02 Thread Tom Lane
Fujii Masao 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 directl

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

2024-10-02 Thread Fujii Masao
On 2024/10/02 11:35, Michael Paquier wrote: On Tue, Oct 01, 2024 at 12:29:15PM -0400, Tom Lane wrote: Fujii Masao 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

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

2024-10-01 Thread Michael Paquier
On Tue, Oct 01, 2024 at 12:29:15PM -0400, Tom Lane wrote: > Fujii Masao 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 con

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

2024-10-01 Thread Tom Lane
Fujii Masao writes: > On 2024/10/01 14:11, Yuto Sasaki (Fujitsu) wrote: >> 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

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

2024-10-01 Thread Fujii Masao
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: `

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

2024-10-01 Thread Yuto Sasaki (Fujitsu)
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:5