libpq parameter parsing problem

Jobin Augustine <[email protected]> Tue, 7 Jan 2020 18:47:06 +0530
Newsgroups gmane.comp.db.postgresql.bugs
Message-ID <CANaTPsrYgSgE2fuj3=4x=Jmx1c+NgkEDzftNknZbrMuqL+aBhQ@mail.gmail.com>
--0000000000006427d6059b8c9870
Content-Type: text/plain; charset="UTF-8"

Hello hackers,
User can pass session-level settings as a parameter in the connection
string like:
psql "host=localhost user=postgres options='-c synchronous_commit=off'"
Which sets the synchronous_commit off for the session.

However, URI spec is not allowing it,
psql postgresql://postgres@localhost:5432/postgres?options="-c
synchronous_commit=off"
psql: error: could not connect to server: extra key/value separator "=" in
URI query parameter: "options"

psql postgresql://postgres@localhost:5432/postgres?options="-c
synchronous_commit off"
psql: error: could not connect to server: FATAL:  -c synchronous_commit
requires a value

Moreover session just hangs forever:
psql postgresql://postgres@localhost:5432/postgres?application_name=hello&options='-c
synchronous_commit=off'
provided that the connection works without the 'options' parameter
specification

Thanks and regards,
Jobin.

--0000000000006427d6059b8c9870
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello=C2=A0<span style=3D"font-family:arial,sans-serif">ha=
ckers</span>,<div>User can pass session-level settings as a parameter in th=
e connection string like:<br>psql &quot;host=3Dlocalhost user=3Dpostgres op=
tions=3D&#39;-c synchronous_commit=3Doff&#39;&quot;<br>Which sets the=C2=A0=
synchronous_commit off for the session.</div><div><br>However, URI spec is =
not allowing it,<br>psql postgresql://postgres@localhost:5432/postgres?opti=
ons=3D&quot;-c synchronous_commit=3Doff&quot;<br>psql: error: could not con=
nect to server: extra key/value separator &quot;=3D&quot; in URI query para=
meter: &quot;options&quot;<br><br>psql postgresql://postgres@localhost:5432=
/postgres?options=3D&quot;-c synchronous_commit off&quot;<br>psql: error: c=
ould not connect to server: FATAL: =C2=A0-c synchronous_commit requires a v=
alue<br><br>Moreover session just hangs forever:<br>psql postgresql://postg=
res@localhost:5432/postgres?application_name=3Dhello&amp;options=3D&#39;-c =
synchronous_commit=3Doff&#39;<br>provided that the connection works without=
 the &#39;options&#39; parameter specification</div><div><br></div><div>Tha=
nks and=C2=A0regards,<br>Jobin.</div></div>

--0000000000006427d6059b8c9870--