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

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: proposal: rounding up time value less than its unit.
Дата
Msg-id CAKFQuwbNPS9E=crLwH1A4WoSn9LhTmh7BvonoYvB8PWJSGxEAA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: rounding up time value less than its unit.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: proposal: rounding up time value less than its unit.
Список pgsql-hackers
On Fri, Sep 26, 2014 at 1:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Robert Haas <robertmhaas@gmail.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.


​Both Robert and myself at one point made suggestions to this effect but I believe at this point we are both good simply solving the <1 rounding and calling it a day.​
 
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.


You are right - both those values are probably quite stupid to set log_rotation_age to...but we cannot error if they choose "1min"

Stephen suggested changing the unit but that particular cure seems to be considerably worse than simply changing floor() to ceil()

I'm out of arguments for why the minimally invasive solution is, for me, the best of the currently proposed solutions.  That option gets my +1.  I have to ask someone else to actually write such a patch but it seems straight forward enough as no one has complained that the solution would be hard to implement - only that they dislike the idea.

David J

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: proposal: rounding up time value less than its unit.
Следующее
От: Robert Haas
Дата:
Сообщение: Re: proposal: rounding up time value less than its unit.