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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "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 23:31:27
Message-ID: ZwRvT2ubzE-AY2oS@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 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.

I may be missing something, of course, but I am under the impression
that ' ' is invalid, meaning that you should use "a%20b" here to get
what you want as %20 would would be translated to a space character.

> Is the "continue" really necessary? Also could we simplify it like this?
>
> for (; *q == ' '; q++);

Sure, it could be changed this way.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2024-10-08 00:00:45 Re: First draft of PG 17 release notes
Previous Message Bruce Momjian 2024-10-07 23:25:11 Re: First draft of PG 17 release notes