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

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "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-07 16:19:59
Message-ID: b89a6d01-0eaa-49cd-bb08-cf9036cc005f@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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
"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 does after this commit:

$ psql -d "postgresql://localhost:5432/postgres?application_name=a b"

I'm not sure if this URI format is valid (according to RFC 3986), though.

+ for (const char *s = q; *s == ' '; s++)
+ {
+ q++;
+ continue;
+ }

Is the "continue" really necessary? Also could we simplify it like this?

for (; *q == ' '; q++);

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2024-10-07 16:30:28 Re: Psql meta-command conninfo+
Previous Message jian he 2024-10-07 16:17:11 Re: Set query_id for query contained in utility statement