SUM doesn't work on two or more columns from different tables - Mailing list pgsql-bugs

From Skeets Norquist
Subject SUM doesn't work on two or more columns from different tables
Date
Msg-id 20000201040234.9964.qmail@web903.mail.yahoo.com
Whole thread Raw
List pgsql-bugs
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               :    Skeets Norquist
Your email address :    skeetsnorquist@yahoo.com


System Configuration
---------------------
  Architecture (example: Intel Pentium)
     :     Intel Pentium Pro

  Operating System (example: Linux 2.0.26 ELF)      :
   Linux 2.2.5-15 (i386) (RedHat 6.0)

  PostgreSQL version (example: PostgreSQL-6.5.1) :
PostgreSQL-6.5.3-1

  Compiler used (example:  gcc 2.8.0)
     :     downloaded RPM


Please enter a FULL description of your problem:
------------------------------------------------

When you try to use the SUM aggregate on each of two
columns from different tables, the results are
incorrect.

I'm trying to select the sum of an int4 column from
one table and the sum of an int4 column from another
table but the results are incorrect for the second
sum.  Sometimes the result columns look like they were
arrived at by repeatedly doubling the true sum a
varying number of times (are the bits getting
shifted?).  I can't figure out the pattern.

Please describe a way to repeat the problem.   Please
try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

=> create table t1 (a int);
CREATE
=> insert into t1 values (1);
INSERT 155081 1
=> insert into t1 values (1);
INSERT 155082 1
=> create table t2 (a int);
CREATE
=> insert into t2 values (1);
INSERT 155092 1
=> select sum(t1.a), sum(t2.a) from t1, t2;
sum|sum
---+---
  2|  2
(1 row)


If you know how this problem might be fixed, list the
solution below:
---------------------------------------------------------------------

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

pgsql-bugs by date:

Previous
From: "Herr Dumont"
Date:
Subject: Correction of my bug report sent on 2000-01-28
Next
From: Marius Ciolacu
Date:
Subject: ...