Re: Timestamp to time_t - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Timestamp to time_t
Date
Msg-id 16628.1253037650@sss.pgh.pa.us
Whole thread Raw
In response to Re: Timestamp to time_t  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: Timestamp to time_t
Re: Timestamp to time_t
List pgsql-hackers
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:
>> Given that the spec requires that 2009-01-31 + interval 1 month =
>> 2009-02-31 (yes, really! see general rule 4 in subsection 6.30), I
>> think we can safely ignore virtually everything it says about
>> date/time handling.
> Codd went on at some length about why this is the right thing to do.
> He was highly critical of systems where adding a month to a date and
> then subtracting month from the result could result in a date which
> was off from the original date by as much as three days.  As a
> mathematician he felt strongly that "(x + y) - y" should equal x --
> even when x is a date and y is an interval.

[ shrug... ]  We *have* that property, for sane cases such as adding and
subtracting a fixed number of days.  For less sane cases, I would point
out to Codd that the current calendar system was not designed by
mathematicians, and trying to superimpose strict mathematical rules on
it just leads to nonsense (like the spec's requirements).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: WIP: generalized index constraints
Next
From: Andrew Gierth
Date:
Subject: Re: Timestamp to time_t