Re: time interval behaviour seems odd - Mailing list pgsql-hackers

From Tom Lane
Subject Re: time interval behaviour seems odd
Date
Msg-id 13391.1071697641@sss.pgh.pa.us
Whole thread Raw
In response to Re: time interval behaviour seems odd  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> Tilo Schwarz <mail@tilo-schwarz.de> writes:
>> tschwarz=> select '-0.1'::interval;
>> interval
>> -------------
>> 00:00:00.10   <---
>> (1 row)

> This is incontestably a bug.  Will fix for 7.4.1.

I've applied the attached patch to 7.4 and HEAD.  It'd probably work in
7.3 as well, but I didn't look.
        regards, tom lane

*** src/backend/utils/adt/datetime.c.orig    Sat Nov 29 14:51:58 2003
--- src/backend/utils/adt/datetime.c    Wed Dec 17 16:33:25 2003
***************
*** 3005,3011 ****                     if (*cp != '\0')                         return DTERR_BAD_FORMAT; 
!                     if (val < 0)                         fval = -(fval);                 }                 else if
(*cp== '\0')
 
--- 3005,3011 ----                     if (*cp != '\0')                         return DTERR_BAD_FORMAT; 
!                     if (*field[i] == '-')                         fval = -(fval);                 }
elseif (*cp == '\0')
 


pgsql-hackers by date:

Previous
From: "Jonathan Gardner"
Date:
Subject: Re: TODO list
Next
From: "Robert Bedell"
Date:
Subject: OLAP CUBE/ROLLUP Operators and GROUP BY grouping sets