Re: Odd sum() problem in 7.2.2 - Mailing list pgsql-general

From Tom Lane
Subject Re: Odd sum() problem in 7.2.2
Date
Msg-id 24878.1033752996@sss.pgh.pa.us
Whole thread Raw
In response to Re: Odd sum() problem in 7.2.2  (Richard Huxton <dev@archonet.com>)
List pgsql-general
Richard Huxton <dev@archonet.com> writes:
> Nothing changed but different numbers of rows returned? Best look at the where
> clause...

> Hmm - "datetime" - tell me sir, are you in a timezone other than Greenwich and
> if you specify timezones explicitly does the problem go away?

It looks to me like 7.2 has a bug in
abstime-to-timestamp-without-time-zone conversion, which is what that
datetime() thing is invoking.  In 7.2.3, running in US EST5EDT zone,
I see:

regression=# select abstime '2002-09-01';
        abstime
------------------------
 2002-09-01 00:00:00-04
(1 row)

regression=# select (abstime '2002-09-01')::timestamp without time zone;
      timestamp
---------------------
 2002-09-01 08:00:00
            ^^ !!!
(1 row)

regression=# select (abstime '2002-09-01')::timestamp with time zone;
      timestamptz
------------------------
 2002-09-01 00:00:00-04
(1 row)


In 7.3beta I get more sensible results:

regression=# select (abstime '2002-09-01')::timestamp without time zone;
      timestamp
---------------------
 2002-09-01 00:00:00
(1 row)

so I'd say Thomas fixed the bug while he was working on the datetime
types this summer ...

            regards, tom lane

pgsql-general by date:

Previous
From: Roland Roberts
Date:
Subject: Re: Fast Deletion For Large Tables
Next
From: Tom Lane
Date:
Subject: Re: transactions