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

From: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: proposal: rounding up time value less than its unit.
Date: 2014-08-21 20:58:55
Message-ID: 1408654735557-5815770.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut-2 wrote
> On 8/21/14 11:16 AM, Tom Lane wrote:
>> Heikki Linnakangas &lt;

> hlinnakangas@

> &gt; writes:
>>> The patch also rounds a zero up to one. A naked zero with no unit is not
>>> affected, but e.g if you have "log_rotation_age=0s", it will not disable
>>> the feature as you might expect, but set it to 1 minute. Should we do
>>> something about that?
>>
>> That sounds like a dealbreaker to me. There are enough places where zero
>> has special meaning that we should not *ever* change zero to non-zero
>> silently.
>
> I don't think I like this idea anyway. If something has units of an
> hour and the user (perhaps misunderstanding the setting) sets it to one
> second, then we shouldn't silently change that to one hour.
>
> If there is a problem with rounding it to zero, then we should perhaps
> raise an error. (And stop treating zero specially. It's a terrible
> idea.)

I'm on board, from the original thread, for errors if the input cannot be
converted to the parameter measurement unit cleanly. By which I mean the
specified value should result in an integer being recorded without rounding.
Specifying a precision less than the default unit thus becomes impossible.

I don't have a problem with zero meaning disabled when appropriate since it
avoids having a separate on/off GUC.

That said the complaint here just seems like a bug in the supplied patch -
zero is zero regardless of whether a unit is specified. The only obvious
exception would be temperature but that isn't relevant here.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/proposal-rounding-up-time-value-less-than-its-unit-tp5811102p5815770.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-08-21 20:59:17 Re: [GSoC2014] Patch ALTER TABLE ... SET LOGGED
Previous Message Andrew Dunstan 2014-08-21 20:43:04 Re: WIP Patch for GROUPING SETS phase 1