Allen Chen <rocklob@gmail.com> writes:
>> That won't really help. The fundamental point here is that '1 day' is
>> not the same concept as '24 hours', because of DST changes; and the
>> interval type treats them as different.
> I don't understand how DST changes matter for a time interval or how that
> could even be factored into calculations. Could you elaborate on that?
The main case where it matters is timestamp plus or minus interval.
As an example, 2011-03-13 is a DST transition day where I live. So:
regression=# select '2011-03-13 01:00'::timestamptz;
timestamptz
------------------------
2011-03-13 01:00:00-05
(1 row)
regression=# select '2011-03-13 01:00'::timestamptz + '1 day'::interval;
?column?
------------------------
2011-03-14 01:00:00-04
(1 row)
regression=# select '2011-03-13 01:00'::timestamptz + '24 hours'::interval;
?column?
------------------------
2011-03-14 02:00:00-04
(1 row)
"Add 1 day" means "produce the same local time on the next day", whereas
"add 24 hours" means exactly that.
regards, tom lane