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

A query with CASE and division results in ArithmeticException #2822

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

A query with CASE and division results in ArithmeticException #2822

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2011-06-13 15:25:58 +0200
From: Alfred Nordman <<alfred.nordman>>
To: SQL devs <>
Version: 11.3.3 (Apr2011-SP1) [obsolete]
CC: @njnes

Last updated: 2011-07-29 10:52:45 +0200

Comment 15845

Date: 2011-06-13 15:25:58 +0200
From: Alfred Nordman <<alfred.nordman>>

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Build Identifier:

Having a CASE statement with a division and an additional arithmetic operation, when there's a 0 value in a column, results in a division by zero ArithmeticException.
Removing the additional arithmetic operation while keeping the division, makes the query produce the correct results.

Reproducible: Always

Steps to Reproduce:

CREATE TABLE t (c INT);
INSERT INTO t VALUES (0);
SELECT CASE WHEN (c = 0) THEN 0 ELSE (c / c + 1) END FROM t;

Actual Results:

ArithmeticException:batcalc./:Division by zero

Expected Results:

+-----------------------+
| ifthenelse_isnull_=_c |
+=======================+
| 0 |
+-----------------------+

MonetDB 5 server v11.3.3 "Apr2011-SP1" (64-bit, 32-bit oids)
Copyright (c) 1993-July 2008 CWI
Copyright (c) August 2008-2011 MonetDB B.V., all rights reserved
Visit http://monetdb.cwi.nl/ for further information
Found 8.0GiB available memory
Libraries:
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

Comment 15878

Date: 2011-07-02 14:09:02 +0200
From: @njnes

Changeset 5e65f282eeab made by Niels Nes niels@cwi.nl in the MonetDB repo, refers to this bug.

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

Changeset description:

handle div-zero protection recusively fixes bug #2822

Comment 15954

Date: 2011-07-17 15:01:22 +0200
From: @drstmane

Changeset b26f389978e4 made by Stefan Manegold Stefan.Manegold@cwi.nl in the MonetDB repo, refers to this bug.

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

Changeset description:

added test for bug #2822

Comment 16010

Date: 2011-07-29 10:52:45 +0200
From: @sjoerdmullender

The Apr2011-SP2 bugfix release is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants