Re: [HACKERS] roundoff problem in time datatype

2005-11-04 Thread Gurjeet Singh
On 10/13/05, Josh Berkus wrote: > Tom, > > > I think my preference is to allow '24:00:00' (but not anything larger) > > as a valid input value of the time datatypes. This for two reasons: > > * existing dump files may contain such values > > * it's consistent with allowing, eg, '12:13

Re: [HACKERS] roundoff problem in time datatype

2005-10-13 Thread Josh Berkus
Tom, > I think my preference is to allow '24:00:00' (but not anything larger) > as a valid input value of the time datatypes. This for two reasons: > * existing dump files may contain such values > * it's consistent with allowing, eg, '12:13:60', which we > allow even though i

Re: [HACKERS] roundoff problem in time datatype

2005-10-13 Thread Tom Lane
Bruce Momjian writes: > Tom Lane wrote: >> I think my preference is to allow '24:00:00' (but not anything larger) >> as a valid input value of the time datatypes. > Is this a must-fix for 8.1? No, since it's a pre-existing issue, but it's the kind of thing that should be changed during a major r

Re: [HACKERS] roundoff problem in time datatype

2005-10-13 Thread Tom Lane
Bruce Momjian writes: > Where are we on this? We haven't decided what to do. I think my preference is to allow '24:00:00' (but not anything larger) as a valid input value of the time datatypes. This for two reasons: * existing dump files may contain such values * it's consistent

Re: [HACKERS] roundoff problem in time datatype

2005-10-13 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian writes: > > Where are we on this? > > We haven't decided what to do. > > I think my preference is to allow '24:00:00' (but not anything larger) > as a valid input value of the time datatypes. This for two reasons: > * existing dump files may contain such va

Re: [HACKERS] roundoff problem in time datatype

2005-10-13 Thread Bruce Momjian
Where are we on this? I see current CVS behaving the same as below, except the last query now returns 24:00:00. --- Tom Lane wrote: > Inserting into a time field with limited precision rounds off, which > is good except for

Re: [HACKERS] roundoff problem in time datatype

2005-09-30 Thread Jim C. Nasby
On Mon, Sep 26, 2005 at 11:46:47AM -0400, Tom Lane wrote: > Jochem van Dieten <[EMAIL PROTECTED]> writes: > > On 9/26/05, Dennis Bjorklund wrote: > >> One reason is because it's what the standard demand. > > > Could you cite that? The only thing I can find in the SQL standard is > > that the hour

Re: [HACKERS] roundoff problem in time datatype

2005-09-30 Thread Jim C. Nasby
On Mon, Sep 26, 2005 at 06:23:06PM +0200, Andreas Pflug wrote: > Tom Lane wrote: > >Dennis Bjorklund <[EMAIL PROTECTED]> writes: > > > >>Do the sql standard say anything on the matter? > > > > > >It doesn't seem very helpful. AFAICS, we should interpret storing > >'23:59:59.99' into a TIME(0) fiel

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Andreas Pflug
Tom Lane wrote: Hm, so the proposal is "round unless that would produce 24:00:00, in which case truncate"? Seems a bit ugly but it would follow the letter of the spec, and avoid rejecting inputs that we used to accept. It's still not very clear what to do with '23:59:60.9' though. I'd handl

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Tom Lane
Andreas Pflug <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> b) If SD is TIME WITHOUT TIME ZONE, then TV is SV, with >> implementation-defined rounding or truncation if necessary. >> >> So it's "implementation-defined" what we do. > IMHO Since 23:59:59.99 probably means "the last milliseconds o

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Dennis Bjorklund
On Mon, 26 Sep 2005, Tom Lane wrote: > b) If SD is TIME WITHOUT TIME ZONE, then TV is SV, with > implementation-defined rounding or truncation if necessary. > > So it's "implementation-defined" what we do. Truncation would avoid the problem but of course loses some of t

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Andreas Pflug
Tom Lane wrote: Dennis Bjorklund <[EMAIL PROTECTED]> writes: Do the sql standard say anything on the matter? It doesn't seem very helpful. AFAICS, we should interpret storing '23:59:59.99' into a TIME(0) field as a cast from TIME(2) to TIME(0), and the spec defines that as 15) If T

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Gaetano Mendola
Tom Lane wrote: > Dennis Bjorklund <[EMAIL PROTECTED]> writes: >> On Mon, 26 Sep 2005, Tom Lane wrote: >>> No, I think the usual notation for a leap-second is '23:59:60'. >>> We do allow 60 in the seconds field for this purpose. > >> Yes, and it can go up to 23:59:60.99 (depending on how many

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Tom Lane
Dennis Bjorklund <[EMAIL PROTECTED]> writes: > Do the sql standard say anything on the matter? It doesn't seem very helpful. AFAICS, we should interpret storing '23:59:59.99' into a TIME(0) field as a cast from TIME(2) to TIME(0), and the spec defines that as 15) If TD is the datetime da

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Tom Lane
Jochem van Dieten <[EMAIL PROTECTED]> writes: > On 9/26/05, Dennis Bjorklund wrote: >> One reason is because it's what the standard demand. > Could you cite that? The only thing I can find in the SQL standard is > that the hour field in an INTERVAL can not exceed 23, not datetimes. SQL99 has

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Jochem van Dieten
On 9/26/05, Dennis Bjorklund wrote: > On Sun, 25 Sep 2005, Tom Lane wrote: >> >> Alternatively: why are we forbidding the value 24:00:00 anyway? Is >> there a reason not to allow the hours field to exceed 23? > > One reason is because it's what the standard demand. Could you cite that? The only th

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Greg Stark
Tom Lane <[EMAIL PROTECTED]> writes: > That's an urban legend. There never have been, and never will be, two > leap seconds instituted in the same minute. We really should reject > anything larger than '23:59:60'. I don't understand. The last second of a normal minute goes from 59.0 to 59.999

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Dennis Bjorklund
On Mon, 26 Sep 2005, Tom Lane wrote: > > Yes, and it can go up to 23:59:60.99 (depending on how many fractional > > seconds one want). > > That's an urban legend. There never have been, and never will be, two > leap seconds instituted in the same minute. We really should reject > anything

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Tom Lane
Dennis Bjorklund <[EMAIL PROTECTED]> writes: > On Mon, 26 Sep 2005, Tom Lane wrote: >> No, I think the usual notation for a leap-second is '23:59:60'. >> We do allow 60 in the seconds field for this purpose. > Yes, and it can go up to 23:59:60.99 (depending on how many fractional > seconds on

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Dennis Bjorklund
On Mon, 26 Sep 2005, Tom Lane wrote: > > Actually, I think there is a case where 24:00 is a proper time. Isn't > > it used for adding leap seconds ? > > No, I think the usual notation for a leap-second is '23:59:60'. > We do allow 60 in the seconds field for this purpose. Yes, and it can go up

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Tom Lane
Dave Cramer <[EMAIL PROTECTED]> writes: > Actually, I think there is a case where 24:00 is a proper time. Isn't > it used for adding leap seconds ? No, I think the usual notation for a leap-second is '23:59:60'. We do allow 60 in the seconds field for this purpose. I suppose there's another pos

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Dave Cramer
Actually, I think there is a case where 24:00 is a proper time. Isn't it used for adding leap seconds ? Dave On 26-Sep-05, at 3:39 AM, Dennis Bjorklund wrote: On Sun, 25 Sep 2005, Tom Lane wrote: Alternatively: why are we forbidding the value 24:00:00 anyway? Is there a reason not to allow

Re: [HACKERS] roundoff problem in time datatype

2005-09-26 Thread Dennis Bjorklund
On Sun, 25 Sep 2005, Tom Lane wrote: > Alternatively: why are we forbidding the value 24:00:00 anyway? Is > there a reason not to allow the hours field to exceed 23? One reason is because it's what the standard demand. Another is that it isn't a proper time, just like feb 31 isn't a proper date.

[HACKERS] roundoff problem in time datatype

2005-09-25 Thread Tom Lane
Inserting into a time field with limited precision rounds off, which is good except for this case: regression=# select '23:59:59.9'::time(0); time -- 24:00:00 (1 row) This is bad because: regression=# select '24:00:00'::time(0); ERROR: date/time field value out of range: "24:00:0