Re: unexpected behavior in combining timestamps with times zone and intervals

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Charles Seaton <cseaton(at)stccmop(dot)org>
Cc: spot(at)tele2(dot)se, pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: unexpected behavior in combining timestamps with times zone and intervals
Date: 2007-11-04 05:35:45
Message-ID: 6005.1194154545@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Charles Seaton <cseaton(at)stccmop(dot)org> writes:
> Thanks for your response. I am wondering whether it is postgres 8.2.5
> that resolves the problem or your time zone setting.

This behavior changed in PG 8.1. Per the release notes:

* Add a separate day field to type interval so a one day interval can be
distinguished from a 24 hour interval (Michael Glaesemann)

Days that contain a daylight saving time adjustment are not 24 hours
long, but typically 23 or 25 hours. This change creates a conceptual
distinction between intervals of "so many days" and intervals of "so
many hours". Adding 1 day to a timestamp now gives the same local time
on the next day even if a daylight saving time adjustment occurs
between, whereas adding 24 hours will give a different local time when
this happens. For example, under US DST rules:

'2005-04-03 00:00:00-05' + '1 day' = '2005-04-04 00:00:00-04'
'2005-04-03 00:00:00-05' + '24 hours' = '2005-04-04 01:00:00-04'

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kevin Hunter 2007-11-04 05:50:13 Re: young guy wanting (Postgres DBA) ammo
Previous Message Myshkin LeVine 2007-11-04 05:27:19 Re: Problem starting the server with Mac OSX