Re: Comment on timezone and interval types - Mailing list pgsql-general

From Tom Lane
Subject Re: Comment on timezone and interval types
Date
Msg-id 17005.1099066600@sss.pgh.pa.us
Whole thread Raw
In response to Re: Comment on timezone and interval types  (Stuart Bishop <stuart@stuartbishop.net>)
List pgsql-general
Stuart Bishop <stuart@stuartbishop.net> writes:
> If you add a 'day' to a timestamp, it should be identical to adding 24
> hours.

No, it should not --- at least not when the addition traverses a DST
switchover time.

> For example, what is '2am April 3rd 2004 US/Eastern + 1 day'? 2am on
> April 4th 2004 didn't exist in that timezone because the clocks were put
> forward and that hour skipped.

The times right at the DST transition are questionable no matter what
we do, but that does not justify your claim that we do not need to fix
this.  For instance, I think 10pm April 3rd (EST) plus '24 hours' ought
to be 11pm April 4th (EDT), but adding '1 day' ought to yield 10pm EDT.
There isn't really any ambiguity about what people will consider the
right answer there.

I think your example has about as much validity as claiming that we
shouldn't support "+ '1 month'" because it's not clear what to do when
adding '1 month' to 'Jan 31'.  Yes, you end up having to define some
corner-case behaviors, but that doesn't render the main cases worthless.

            regards, tom lane

pgsql-general by date:

Previous
From: Cott Lang
Date:
Subject: UTF-8 -> ISO8859-1 conversion problem
Next
From: Guy Fraser
Date:
Subject: Re: Comment on timezone and interval types