Re: time interval behaviour seems odd

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tilo Schwarz <mail(at)tilo-schwarz(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: time interval behaviour seems odd
Date: 2003-12-17 21:47:21
Message-ID: 13391.1071697641@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> Tilo Schwarz <mail(at)tilo-schwarz(dot)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);
}
else if (*cp == '\0')

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Bedell 2003-12-17 21:56:06 OLAP CUBE/ROLLUP Operators and GROUP BY grouping sets
Previous Message Jonathan Gardner 2003-12-17 21:38:56 Re: TODO list