Re: Timestamp to time_t

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: "Andrew Gierth" <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, pgsql-hackers(at)postgresql(dot)org, "Scott Mohekey" <scott(dot)mohekey(at)telogis(dot)com>
Subject: Re: Timestamp to time_t
Date: 2009-09-15 18:00:50
Message-ID: 16628.1253037650@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov> writes:
> Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2009-09-15 18:01:32 Re: Timestamp to time_t
Previous Message Robert Haas 2009-09-15 17:48:07 Re: WIP: generalized index constraints