Odd sum() problem in 7.2.2

From: andreas(at)sparcy(dot)net (Andreas Forsgren)
To: pgsql-general(at)postgresql(dot)org
Subject: Odd sum() problem in 7.2.2
Date: 2002-10-04 10:37:04
Message-ID: a48a43b7.0210040237.5fd11160@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2002-10-04 11:13:05 Re: Structured Types, Oids and Reference Types
Previous Message Craig Anslow 2002-10-04 10:34:58 Re: Structured Types, Oids and Reference Types