Subject: Postgres time Problem
To: Thomas Lockhart <Thomas.G.Lockhart@jpl.nasa.gov>
From: Henry B. Hotz <hotz@jpl.nasa.gov>
List: port-mac68k
Date: 07/16/1999 10:05:46
First of all let me say thanks, Tom.

Now as to the problem with DBL_MIN.  I would point at gcc before I pointed
at NetBSD.  I presume Linux/m68k uses the same value of DBL_MIN that we do
and should have a close relative of the version of gcc that NetBSD uses.
For these tests the version of NetBSD is 1.3.2 on a Mac 840av, and the
version of gcc is 2.7.2.2+myc1.

At 8:58 PM -0700 7/15/99, Thomas Lockhart wrote:
>> >> The problem is that 'now' - 'current' is more than 200 days.
>
>OK, on your NetBSD/68k machine, there seems to be a problem passing
>around a double value which is identically equal to DBL_MIN. This is the
>"reserved value" I had chosen to represent 'current', and it ends up
>being evaluated as something like zero instead. This evaluates to
>2000-01-01 00:00:00 GMT, which is currently ~169 days from 'now' (rather
>than the "more than 200 days" you saw earlier).
>
>Here is your system after I modified DT_CURRENT to be 1e-10 rather than
>DBL_MIN (the changes were in src/include/utils/dt.h):
>
>postgres=> select datetime 'now' - 'current';
>?column?
>--------
>@ 0
>(1 row)
>
>I've installed v6.5.1 (actually today's cvs tree, which should be about
>the same thing). I haven't actually tracked down why your machine loses
>the value set as DBL_MIN, or at least loses the ability to compare it,
>but I figure that is a NetBSD problem.
>
>afaik you could change the definition of DT_CURRENT as I did above and
>get reasonable behavior in a production database.
>
>I left the postmaster dead, and my installation is entirely
>self-contained within /usr/local/dist/postgres so won't interfere if you
>restart your v6.4.2 postmaster. btw, I left a tiny bit of crufty
>debugging stuff but can clean that up if you want to move to v6.5.1.
>
>Good luck, and let me know if I can help with anything more.
>
>                     - Tom
>
>--
>Thomas Lockhart
>Caltech/JPL
>Interferometry Systems and Technology

Again, thanks for looking into it, Tom.

Do the NetBSD folks have any suggestions as to the prefered fix?  Maybe I
should upgrade to 1.4 and try again since I think NetBSD switched to egcs
for that.  Maybe I should try turning optimization off?  Maybe we should
just change DT_CURRENT to DBL_MIN + 1 LSB or something.

Gee, does this mean that Postgres on NetBSD/m68k has a Y2K problem?  Sorry,
Sorry, Sorry, I couldn't resist. ;-)

Signature failed Preliminary Design Review.
Feasibility of a new signature is currently being evaluated.
h.b.hotz@jpl.nasa.gov, or hbhotz@oxy.edu