"This series deliberately does not change the existing behavior for positive GUC
values that round to zero.  For example, statement_timeout = ‘0.4ms’ still
becomes 0.  It also does not address the separate parse_real() unit-conversion
precision issue."

I am curious why you chose to preserve the existing behavior for
positive GUC values to zero?
Another more concerning drawback for this conversion is that it does
not respect the original value.

it could give wrong values for these:

    statement_timeout = '0.144min'          -> 9s     (8.64 s)
    statement_timeout = '0.021d'            -> 1h     (30.24 min)

I think this results from 1a83a80a2fe (PG12), convert_to_base_unit()
rounds a fractional value to the next smaller unit than the input one.
It was added for the sake of showing memory settings nicely, but
without taking time value into proper consideration [2].

    cvalue = rint(cvalue / table[i + 1].multiplier) *
        table[i + 1].multiplier;

Converting time exactly without next-unit rounding seems able to cover
both the truncation and zeroing well. I understand that this is a
broader behavior change. But it seems worthwhile to trade a bit of
readability for accuracy.

    '0.144min'                  -> 8640ms
    '0.020d'                    -> 1728s
    '0.021d'                    -> 1814400ms
   '-0.4ms', '0.4ms'           -> rejected by rule 2

Does this seem sensible to you?

[1] https://postgr.es/m/[email protected]
[2] 
https://postgr.es/m/[email protected]

-- 
Regards,
Xuneng Zhou
HighGo Software Co., Ltd.


Reply via email to