Re: proposal: rounding up time value less than its unit. - Mailing list pgsql-hackers

From Robert Haas
Subject Re: proposal: rounding up time value less than its unit.
Date
Msg-id CA+TgmoZk3aNsz_-Z0BxkPgWSdqz7MU7ZP6rPaU+WoqOh_YUnvQ@mail.gmail.com
Whole thread Raw
In response to Re: proposal: rounding up time value less than its unit.  (Greg Stark <stark@mit.edu>)
Responses Re: proposal: rounding up time value less than its unit.
Re: proposal: rounding up time value less than its unit.
List pgsql-hackers
On Sat, Aug 23, 2014 at 6:39 PM, Greg Stark <stark@mit.edu> wrote:
> On Sat, Aug 23, 2014 at 9:38 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>
>> Ah.  Okay, but then what's wrong with the original proposal of "use ceil()
>> instead of floor()"?  Basically I think the idea of treating fractions
>> less than one differently from fractions greater than one is bogus; nobody
>> will ever find that intuitive.
>
> Or make it an error to specify a value that rounds to 0 but isn't 0.

I liked David Johnston's even stronger suggestion upthread: make it an
error to specify a value requires rounding of any kind.  In other
words, if the minimum granularity is 1 minute, you can specify that as
60 seconds instead, but if you write 59 seconds, we error out.  Maybe
that seems pedantic, but I don't think users will much appreciate the
discovery that 30 seconds means 60 seconds.  They'll be happier to be
told that up front than having to work it out afterward.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Proposal for CSN based snapshots
Next
From: Andres Freund
Date:
Subject: Re: proposal: rounding up time value less than its unit.