Re: pub/sub - specifying optional parameters without values.

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Smith <smithpb2250@gmail.com>, Zheng Li <zhengli10@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2023-01-31T05:42:24Z
Lists: pgsql-hackers
On Tue, Jan 31, 2023 at 4:25 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Peter Smith <smithpb2250@gmail.com> writes:
> > I'd forgotten about the 'streaming' option -- AFAIK this was
> > previously a boolean parameter and so its [= value] part can also be
> > omitted. However, in PG16 streaming became an enum type
> > (on/off/parallel), and the value can still be omitted but that is not
> > really being covered by the new generic text note about booleans added
> > by yesterday's patch.
>
> Hmph.  I generally think that options defined like this (it's a boolean,
> except it isn't) are a bad idea, and would prefer to see that API
> rethought while we still can.
>

We have discussed this during development and considered using a
separate option like parallel = on (or say parallel_workers = n) but
there were challenges with the same. See discussion in email [1]. We
also checked that we have various other places using something similar
for options. For example COPY commands option: HEADER [ boolean |
MATCH ]. Then GUCs like
synchronous_commit/constraint_exclusion/huge_pages/backslash_quote
have similar values. Then some of the reloptions like buffering,
vacuum_index_cleanup also have off/on/auto values. I think having an
enum where off/on are present is already used. In this case, the main
reason is that after discussion we felt it is better to have streaming
as an enum with values off/on/parallel instead of introducing a new
option.

[1] - https://www.postgresql.org/message-id/CAA4eK1Kt67RdW0WTR-LTxasj3pyukPCYhfA0arDUNnsz2wh03A%40mail.gmail.com

-- 
With Regards,
Amit Kapila.



Commits

  1. Doc: clarify behavior of boolean options in replication protocol commands.

  2. Doc: clarify behavior of boolean options in replication commands.