Re: interval integer comparison - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: interval integer comparison
Date
Msg-id 20050602122632.GA6785@wolff.to
Whole thread Raw
In response to Re: interval integer comparison  (Havasvölgyi Ottó <h.otto@freemail.hu>)
List pgsql-general
On Thu, Jun 02, 2005 at 13:26:32 +0200,
  Havasvölgyi Ottó <h.otto@freemail.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.

pgsql-general by date:

Previous
From: "Dinesh Pandey"
Date:
Subject: Re: [SQL] index row size 2728 exceeds btree maximum, 2713
Next
From: Bruno Wolff III
Date:
Subject: Re: index row size 2728 exceeds btree maximum, 27