Re: proposal: rounding up time value less than its unit.

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Gregory Smith <gregsmithpgsql(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, David Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: rounding up time value less than its unit.
Date: 2014-09-26 17:27:51
Message-ID: 20140926172751.GU16422@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom,

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > If we want the narrowest possible fix for this, I think it's "complain
> > if a non-zero value would round to zero". That fixes the original
> > complaint and changes absolutely nothing else. But I think that's
> > kind of wussy. Yeah, rounding 29 seconds down to a special magic
> > value of 0 is more surprising than rounding 30 seconds up to a minute,
> > but the latter is still surprising. We're generally not averse to
> > tighter validation, so why here?
>
> So in other words, if I set "shared_buffers = 100KB", you are proposing
> that that be rejected because it's not an exact multiple of 8KB? This
> seems like it's throwing away one of the fundamental reasons why we
> invented GUC units in the first place.

I don't believe that's what was suggested at all (it's not what I was
suggesting, in any case), but rather "shared_buffers = 1KB" would error
(erm, won't it error *anyway*? so this wouldn't be a change there..)

"shared_buffers = 100KB" would be round the same as today.

> I apparently have got to make this point one more time: if the user
> cares about the difference between 30sec and 1min, then we erred in
> designing the GUC in question; it should have had a smaller unit.
> I am completely not impressed by arguments based on such cases.
> The right fix for such a case is to choose a different unit for the GUC.

I don't think anyone is argueing that we should do away with the
rounding rules entirely, only that we should a) require units to be
specified, and b) error if the value specified is below '1 unit', but
still non-zero, as it would then be rounded to zero.

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2014-09-26 17:37:13 Re: proposal: rounding up time value less than its unit.
Previous Message Tom Lane 2014-09-26 17:22:41 Re: proposal: rounding up time value less than its unit.