Re: Problem with intervals

From: Richard Huxton <dev(at)archonet(dot)com>
To: Bob Smith <bsmith(at)h-e(dot)com>, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Problem with intervals
Date: 2003-12-02 08:56:05
Message-ID: 200312020856.05469.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tuesday 02 December 2003 05:09, Bob Smith wrote:
> I'm getting an unexpected result using intervals in an expression:
>
> select ('2003-10-26 0:00:00'::timestamp + '1 day'::interval)::date;
> date
> ------------
> 2003-10-26

> I assumed '1 day' would always increment the date by 1, but it appears
> that '1 day' just means '24 hours', and due to the daylight/standard
> time shift, October 26 was 25 hours long this year.
>
> Is this a Postgres bug, or is this correct SQL behavior? I'm running
> Postgres 7.2.2.

Expected, because you're acting on a timestamp. When you start looking at time
handling across timezones and daylight saving systems across the world it
does get a bit complicated.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Karel Zak 2003-12-02 09:57:14 Re: Validity check in to_date?
Previous Message Tomasz Myrta 2003-12-02 06:07:42 Re: Concatenating multiple fetches into a single string