StartupMessage parameters - free-form or not?

From: Jaka Jančar <jaka(at)kubje(dot)org>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: StartupMessage parameters - free-form or not?
Date: 2020-07-12 00:14:27
Message-ID: CAMUPXmpxcyhJT-m1_TbjCYTHTsiJbmvwM9hmERsxjb+qPrxOgA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2020-07-12 00:30:37 Re: Default setting for enable_hashagg_disk
Previous Message Tomas Vondra 2020-07-12 00:11:01 Re: POC: postgres_fdw insert batching