From: | "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] datetime regression test fails at daylight savings transitions |
Date: | 1998-10-26 05:34:09 |
Message-ID: | 363409D1.8B8A6319@alumni.caltech.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> Whoops. Looks like "'1 day'::timespan" is treated as "24 hours",
> not as "the same local time next day". Twice a year (if you observe
> DST) there is a difference.
Sure. But timespan doesn't know anything about date context. What you
are really asking about is the behavior with math across two date/time
data types.
> It's debatable whether this is a bug in the date/time datatypes,
> or just sloppy coding of the regression test. It probably oughta be
> documented somewhere, either way. Also, whichever way we decide the
> above expressions ought to be handled, the docs ought to explain
> how to get the other functionality.
Hmm. So the debate won't cover whether Tom got it right, just how wrong
he got it, eh? :)
The docs actually mention the distinction between "qualitative time"
(years and months) and "quantitative time" (days, hours, minutes,
seconds) when discussing the "timespan" data type.
You will find that months and years do behave the way you would expect,
since they are stored as "qualitative" times. So adding a month to a
time at the end of the previous month will try to line things up:
tgl=> select '1998-01-31'::datetime + '1 month'::timespan;
----------------------------
Sat Feb 28 00:00:00 1998 GMT
The real lesson to me is to never put out a "last call" to ask people to
run the regression tests on the day of a daylight savings time
transition...
- Tom
From | Date | Subject | |
---|---|---|---|
Next Message | Peter T Mount | 1998-10-26 06:45:55 | Web site is broken |
Previous Message | Bruce Momjian | 1998-10-26 03:06:52 | Re: [HACKERS] psql's help (the LIMIT stuff) |