On Mon, Mar 24, 2025 at 10:35:41PM +0300, Nikolay Shaplov wrote:
> We can have isset_offset, but then we have redesign all options with
> custom unset behavior to use it, instead of unreachable default value.
> This will make it consistent then.

I don't see any reason why we are compelled to redesign all such options,
but in any case, I would think that would be preferable to magic special
values.  For example,

        /* -1 is used to disable max threshold */
        vac_max_thresh = (relopts && relopts->vacuum_max_threshold >= -1)
                ? relopts->vacuum_max_threshold
                : autovacuum_vac_max_thresh;

would become something like

        if (relopts && relopts->vacuum_max_threshold_set)
                vac_max_thresh = relopts->vacuum_max_threshold;
        else
                vac_max_thresh = autovacuum_vac_max_thresh;

The former requires you to know that the reloption defaults to -2 if not
set, which does not seem particularly obvious to me.  At least, I did not
find this out-of-range reloption default technique obvious when I was
working on autovacuum_vacuum_max_threshold.

But again, I don't see any strong reason why we must change all such
reloptions.

-- 
nathan


Reply via email to