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.