Re: Strange results with date/interval arithmetic

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Thomas Lockhart <lockhart(at)fourpalms(dot)org>
Subject: Re: Strange results with date/interval arithmetic
Date: 2002-01-08 22:36:01
Message-ID: 200201082236.g08Ma1S06205@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I am seeing strange results from date/interval computations involving
> > months.
>
> Ah, this is what we get for running the regression tests in only one
> time zone :-(

Yes, I realized the problem was that "2001-03-01" for +1 GMT timezone
comes out as "2001-02-28 23:00 GMT", and when you subtract a month from
that, you get "2001-01-28 23:00" and adding the +1 timezone gives you
"2001-01-29" which is not what you expected.

> The problem appears to be cut-and-paste errors in timestamp.c and
> pg_proc.h: various things that should be timestamp are timestamptz
> or vice versa. See attached proposed patches.

Oh, so that is why the difference between timestamp and timestamptz is
so important.

> long-suffering beta testers, just to adjust two pg_proc entries?
> We may not have much choice.
>
> Sigh. RC1 is off again.

Ouch. :-)

At least it is before final. Can we give people on hackers an SQL
script to run in every database to fix this? That is how we have
handled this in the past. Perhaps we can update the catversion as part
of the patch too. (We have never done that before.)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-01-08 22:45:57 Re: Strange results with date/interval arithmetic
Previous Message Tom Lane 2002-01-08 22:28:41 Re: Strange results with date/interval arithmetic