Re: libpq parameter parsing problem

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Jobin Augustine <jobinau(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: libpq parameter parsing problem
Date: 2020-01-07 13:27:08
Message-ID: 38896fd5-afe9-6922-0034-63d32a04cbcf@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 07/01/2020 15:17, Jobin Augustine wrote:
> 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(at)localhost:5432/postgres?options="-c
> synchronous_commit=off"
> psql: error: could not connect to server: extra key/value separator "="
> in URI query parameter: "options"

The "-c synchronous_commit=off" string is part of the value for the
"options" keyword. So it needs to be URI encoded:

psql
"postgresql://postgres(at)localhost:5432/postgres?options=-c%20synchronous_commit%3Doff"

- Heikki

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Oleksandr Shulgin 2020-01-07 14:23:41 Re: libpq parameter parsing problem
Previous Message Jobin Augustine 2020-01-07 13:17:06 libpq parameter parsing problem