Bugs item #2593341, was opened at 2009-02-12 15:53
Message generated for change (Comment added) made by nielsnes
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: Closed
>Resolution: Fixed
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

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

>Comment By: Niels Nes (nielsnes)
Date: 2009-02-12 21:59

Message:
test added to BugTracker-2009.
Optimizer pushed the select y2/y2 to the same level as the having and
executed even earlier. Fix now by disallowing push down of selects with
'unsafe' functions. 

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

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

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Monetdb-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-bugs

Reply via email to