Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Division By Zero #3742

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

Division By Zero #3742

monetdb-team opened this issue Nov 30, 2020 · 0 comments

Comments

@monetdb-team
Copy link

@monetdb-team monetdb-team commented Nov 30, 2020

Date: 2015-06-22 02:24:20 +0200
From: Raffy <>
To: SQL devs <>
Version: 11.19.11 (Oct2014-SP3)
CC: @njnes

Last updated: 2017-12-20 22:15:31 +0100

Comment 20935

Date: 2015-06-22 02:24:20 +0200
From: Raffy <>

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0
Build Identifier:

This throws a division by zero:

SELECT
count(*) / ((max("end")-min(start)) / 60)
FROM t
GROUP BY s
HAVING max("end")-min(start)<>0 ;

While this does not:

SELECT
count(*) / ((max("end")-min(start)))
FROM t
GROUP BY s
HAVING max("end")-min(start)<>0;

Recreate with:

Reproducible: Always

Steps to Reproduce:

create table t ("end" timestamp, start timestamp, s text);
insert into t ("2015-03-01 00:00:00.135000", "2015-03-01 00:18:00.258000", "foo");
insert into t ("2015-03-01 00:04:00.135000", "2015-03-01 00:22:00.258000", "bar");
SELECT
count(*) / ((max("end")-min(start)) / 60)
FROM t
GROUP BY s
HAVING max("end")-min(start)<>0 ;

Actual Results:

Division by zero (which it shouldn't!)

Comment 20941

Date: 2015-06-22 21:44:01 +0200
From: @njnes

fixed in jul2015 branch

Comment 21224

Date: 2015-08-28 13:42:57 +0200
From: @sjoerdmullender

Jul2015 has been released.

Comment 26037

Date: 2017-12-20 22:15:31 +0100
From: MonetDB Mercurial Repository <>

Changeset 0276d6b12a9b made by Martin Kersten mk@cwi.nl in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=0276d6b12a9b

Changeset description:

Avoid append instructions to disappear
Calling this optimizer after a multiplex expansion
could lead to removal of append() instructions.
The test showing it div_zero.Bug-3742.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant