Re: interval integer comparison

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: interval integer comparison
Date: 2005-06-02 12:26:32
Message-ID: 20050602122632.GA6785@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 02, 2005 at 13:26:32 +0200,
Havasvölgyi Ottó <h(dot)otto(at)freemail(dot)hu> wrote:
>
> I tried to simulate this unexpected result, but with no success. Here in
> Hungary we had daylight saving this year on the 27th of March
> (http://webexhibits.org/daylightsaving/b.html) So I tried these:
>
> select '2005-03-28'::date - '1 day'::interval;
> select '2005-03-28'::timestamp - '1 day'::interval;
> select '2005-03-28'::date - '24 hour'::interval;
> select '2005-03-28'::timestamp - '24 hour'::interval;
>
> Each of the results were the same: 2005-03-27 00:00:00
>
> I tried with a larger interval too but I didn't experience any shift in
> hours. By the way, I use PG 8.0.3 on WinXP SP1, I just experiment with
> Postgres.

I double checked and the promotion is to TIMESTAMP WITHOUT TIME ZONE so
so daylight savings won't in fact be a problem.

However, subtracting an integer will avoid the conversion and should
run slightly faster.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2005-06-02 12:31:50 Re: index row size 2728 exceeds btree maximum, 27
Previous Message Dinesh Pandey 2005-06-02 12:18:47 Re: [SQL] index row size 2728 exceeds btree maximum, 2713