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

From andreas@sparcy.net (Andreas Forsgren)
Subject Odd sum() problem in 7.2.2
Date
Msg-id a48a43b7.0210040237.5fd11160@posting.google.com
Whole thread Raw
Responses Re: Odd sum() problem in 7.2.2
List pgsql-general
I'm stuck. The following two snippets gives me two different results,
and I can't figure out why;

1) select abs(0 + int4(sum((int4(ss7_rel_timestamp_sec) - int4
   (start_timestamp_sec)) / 60))) from session_billed where (b_nr
   like '12345678%' and datetime(ss7_rel_timestamp_sec) >=
   '2002-09-01' and datetime(ss7_rel_timestamp_sec) < '2002-10-01'
   and session_status_reached >= 20);

   = 5845507 and count(*) [1] gives me: 286109

2) select int4(sum(ss7_rel_timestamp_sec - start_timestamp_sec) / 60)
   from session_billed where b_nr like '12345678%' and
   ss7_rel_timestamp_sec >= '2002-09-01' and ss7_rel_timestamp_sec
   < '2002-10-01' and session_status_reached >= 20;

   = 5986420 and count(*) [1] gives me: 286304

 ss7_rel_timestamp_sec = abstime
   start_timestamp_sec = abstime
                  b_nr = character varying(32)
session_status_reached = integer

There have been no changes in the table between these two queries.
PostgreSQL 7.2.2 on i686-pc-linux-gnu, compiled by GCC 2.95.4.

[1] select count(*) from session_billed where <rest of original query>

--
This is your life, and it's ending one minute at a time.

pgsql-general by date:

Previous
From: "Michael Paesold"
Date:
Subject: Re: [HACKERS] Anyone want to assist with the translationof the Advocacy
Next
From: "Darrell Skogman"
Date:
Subject: Performing INSERT from a Trigger fired function