Bugs item #2593341, was opened at 2009-02-12 16:53
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2593341&group_id=56967

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQL/Core
Group: SQL CVS Head
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jens Oehlschlägel (jens_oehl)
Assigned to: Niels Nes (nielsnes)
Summary: HAVING filters too late => division by zero

Initial Comment:
-- scary in Feb2009Alpha Win32

CREATE TABLE div0 (
  x DOUBLE
, y DOUBLE
)
;

INSERT INTO div0 VALUES (1,0);
INSERT INTO div0 VALUES (1,0);
INSERT INTO div0 VALUES (2,1);
INSERT INTO div0 VALUES (2,1);

SELECT MIN(x2) AS x3, SUM(y2) AS y3
FROM (
        SELECT x as x2, SUM(y) as y2
        FROM div0
        GROUP BY x
        HAVING SUM(y)>0  -- now y2 should always >0
) as Sub
WHERE y2/y2 < 0  -- but here we get a division by zero
GROUP BY x2
;
-- gives erroneously
-- !ArithmeticException:batcalc./:Division by zero
-- also from a performance perspective
-- we want to filter HAVING as soon as possible

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=482468&aid=2593341&group_id=56967

------------------------------------------------------------------------------
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to