StartupMessage parameters - free-form or not? - Mailing list pgsql-hackers

From Jaka Jančar
Subject StartupMessage parameters - free-form or not?
Date
Msg-id CAMUPXmpxcyhJT-m1_TbjCYTHTsiJbmvwM9hmERsxjb+qPrxOgA@mail.gmail.com
Whole thread Raw
Responses Re: StartupMessage parameters - free-form or not?
List pgsql-hackers
Hi,

I wrote a Postgres client and in it I allow the user to specify arbitrary StartupMessage parameters (Map<string,string>). This is convenient because the user can for example set search_path without issuing a separate SET query or encoding things into the "options" parameter. The protocol documentation also says that the latter is deprecated and what I'm doing (if I understand it right) is preferred.

A fellow author of a driver for a different language reminds me that libpq explicitly enumerates the supported parameters in the docs, and I checked the code, and indeed there is a whitelist and others are rejected. So technically, he's correct: it's nowhere documented that sending e.g. search_path in StartupMessage parameters will work, and for that matter whether everything that you can set using SET you can also send there.

What is the proper behavior for a driver here:
 1. Whitelist parameters like libpq does, or
 2. Allow the user to send anything, with the understanding it'll work the same as SET

Thanks!
Jaka

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: POC: postgres_fdw insert batching
Next
From: Tomas Vondra
Date:
Subject: Re: Default setting for enable_hashagg_disk