Received: from localhost (IDENT:root@hectic-2.jpl.nasa.gov [128.149.68.204]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA44814 for ; Mon, 3 Jan 2000 10:38:54 -0500 (EST) (envelope-from lockhart@alumni.caltech.edu) Received: from alumni.caltech.edu (lockhart@localhost [127.0.0.1]) by localhost (8.8.7/8.8.7) with ESMTP id IAA00806; Mon, 3 Jan 2000 08:48:10 GMT Sender: lockhart@hub.org Message-ID: <3870624A.BA0E8BE5@alumni.caltech.edu> Date: Mon, 03 Jan 2000 08:48:10 +0000 From: Thomas Lockhart X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: Tom Lane CC: Tulassay Zsolt , pgsql-sql@hub.org Subject: Re: [SQL] timespan problem References: <20530.946771110@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > The problem appears to be an internal > overflow in timespan_in... > Looking into it, the guilty party seems to be tm2timespan() which > blithely assumes that it need not worry about overflow from its > "time" field to its "month" field: > span->month = ((tm->tm_year * 12) + tm->tm_mon); > span->time = ((((((tm->tm_mday * 24) + tm->tm_hour) * 60) + > tm->tm_min) * 60) + tm->tm_sec); > span->time = JROUND(span->time + fsec); > Thomas, you want to deal with this one? Sure. In the meantime, change the "24" to "24.0" (in the file src/backend/utils/adt/dt.c around line 2444; hmm, is that line number a coincidence??) and things will start working :( btw, there is no possibility for overflow from "time" to "month"; see below... > Or is this code all going away in 7.0 anyway? No, the code is likely to stay since timespan needs to distinguish between "qualitative time" like months and years and "quantitative time" like hours and seconds. "time" is stored as a double, but the calculation was being done with all integers, which lead to the overflow problem in intermediate results. Sorry about that. Will commit changes soon. - Thomas -- Thomas Lockhart lockhart@alumni.caltech.edu South Pasadena, California