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 error, when should not divide at 0 #2887

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

Division by zero error, when should not divide at 0 #2887

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


Copy link

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

Date: 2011-09-19 18:06:59 +0200
From: Alfred Nordman <<alfred.nordman>>
To: SQL devs <>
Version: 11.3.7 (Apr2011-SP2) [obsolete]
CC: @njnes

Last updated: 2011-09-30 10:58:43 +0200

Comment 16303

Date: 2011-09-19 18:06:59 +0200
From: Alfred Nordman <<alfred.nordman>>

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1
Build Identifier:

Server returns division by zero, even though it should not divide at 0.

Reproducible: Always

Steps to Reproduce:

Create table t (c int);
Insert into t values (0);
select min (case when "c" = 0 then 4 else 3/c end) from t;
drop table t;

Actual Results:

ArithmeticException:batcalc./:Division by zero

Expected Results:

a result set of one row, with the value 4

MonetDB 5 server v11.3.1 "Apr2011" (64-bit, 64-bit oids)
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2011 MonetDB B.V., all rights reserved
Visit for further information
Found 8.0GiB available memory
libpcre: 8.10 2010-06-25
openssl: OpenSSL 1.0.0a 1 Jun 2010
libxml2: 2.7.7
Compiled by: sjoerd@LAB03 (x86_64-pc-winnt)
Compilation: cl -GF -W3 -wd4273 -wd4102 -MD -nologo -Ox
Linking : cl -GF -W3 -wd4273 -wd4102 -MD -nologo -Ox

"C:\Program Files\MonetDB\MonetDB5\bin\mserver5.exe" --set "prefix=C:\Program Files\MonetDB\MonetDB5" --set "exec_prefix=C:\Program Files\MonetDB\MonetDB5" "--dbfarm=C:\Users\Rjacober\AppData\Roaming\MonetDB5\dbfarm"

Comment 16304

Date: 2011-09-19 20:11:31 +0200
From: @sjoerdmullender

Bug #2822 is very similar, but that one has been fixed.

Comment 16307

Date: 2011-09-20 10:15:10 +0200
From: @njnes

only case expressions in projections where correctly rewritten for div by zero problems. Now also group by is handled.

Comment 16308

Date: 2011-09-20 10:15:26 +0200
From: @njnes

added test div_by_zero.Bug-2887.sql

Comment 16309

Date: 2011-09-20 10:21:02 +0200
From: @njnes

Changeset 0c1fd1092f5d made by Niels Nes in the MonetDB repo, refers to this bug.

For complete details, see http//devmonetdborg/hg/MonetDB?cmd=changeset;node=0c1fd1092f5d

Changeset description:

fixed bug #2887, also rel_groupby is now rewritten for case/div by zero problems.

Comment 16349

Date: 2011-09-30 10:58:43 +0200
From: @grobian

Released in Aug2011-SP1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant