Re: libpq parameter parsing problem

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: libpq parameter parsing problem
Дата
Msg-id 38896fd5-afe9-6922-0034-63d32a04cbcf@iki.fi
обсуждение исходный текст
Ответ на libpq parameter parsing problem  (Jobin Augustine <jobinau@gmail.com>)
Список 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@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@localhost:5432/postgres?options=-c%20synchronous_commit%3Doff"

- Heikki



В списке pgsql-bugs по дате отправления:

Предыдущее
От: Jobin Augustine
Дата:
Сообщение: libpq parameter parsing problem
Следующее
От: Oleksandr Shulgin
Дата:
Сообщение: Re: libpq parameter parsing problem