Re: [SQL] Bug with Daylight Savings Time & Interval

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: josh(at)agliodbs(dot)com
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [SQL] Bug with Daylight Savings Time & Interval
Date: 2002-05-21 02:47:40
Message-ID: 17307.1021949260@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers pgsql-sql

Josh Berkus <josh(at)agliodbs(dot)com> writes:
> Found this interesting bug:
> jwnet=> select ('2001-07-31 10:00:00 PST'::TIMESTAMP) + ('249 days'::INTERVAL)
> ;
> ?column?
> ------------------------
> 2002-04-06 10:00:00-08
> (1 row)

> jwnet=> select ('2001-07-31 10:00:00 PST'::TIMESTAMP) + ('250 days'::INTERVAL)
> ;
> ?column?
> ------------------------
> 2002-04-07 11:00:00-07

This isn't a bug per the existing definition of INTERVAL. '250 days' is
defined as '250*24 hours', exactly, no more no less. When you move
across a DST boundary you get behavior like the above.

I've opined several times that interval should account for three
separate units: months, days, and seconds. But our time-meister
Tom Lockhart doesn't seem to have taken any interest in the idea.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Josh Berkus 2002-05-21 05:57:46 Re: [SQL] Bug with Daylight Savings Time & Interval
Previous Message Josh Berkus 2002-05-20 22:34:32 Bug with Daylight Savings Time & Interval

Browse pgsql-hackers by date

  From Date Subject
Next Message Lamar Owen 2002-05-21 03:12:21 Re: Redhat 7.3 time manipulation bug
Previous Message Tom Lane 2002-05-21 00:08:24 Re: Language-specific initialization actions

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-05-21 03:09:23 Re: MacOS X Shared Buffers (SHMMAX)?
Previous Message D. Duccini 2002-05-21 02:37:33 Re: Guarantee uniqueness of PGP key