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

case evaluted to early #3186

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

case evaluted to early #3186

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

Comments

@monetdb-team
Copy link

Date: 2012-11-16 12:11:58 +0100
From: @bartscheers
To: SQL devs <>
Version: 11.13.3 (Oct2012)
CC: @njnes

Last updated: 2013-01-22 09:29:11 +0100

Comment 17946

Date: 2012-11-16 12:11:58 +0100
From: @bartscheers

User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:16.0) Gecko/20100101 Firefox/16.0
Build Identifier:

sql> SELECT CASE WHEN TRUE THEN -10. ELSE 0/0 END;
division by zero.
but
sql>
sql>SELECT CASE WHEN TRUE THEN -10 ELSE 0/0 END;
+---------------------+
| isnull_single_value |
+=====================+
| -10 |
+---------------------+
1 tuple (1.992ms)

Reproducible: Always

Actual Results:

division by zero

Expected Results:

same result for the int case

We use this on tables where we check if a value c2 is less than 10^{-6}. If so we print 10.0 else c1/c2.

Comment 17947

Date: 2012-11-16 12:23:40 +0100
From: @bartscheers

A work around would be
SELECT coalesce (CASE WHEN TRUE THEN -10. end, case when false then 0/0 END);

Comment 17994

Date: 2012-11-24 17:10:57 +0100
From: @njnes

added test case_evaluated_too_early.Bug-3186.sql

fixed exp_case_fixup to also handle this case

Comment 17995

Date: 2012-11-24 17:11:52 +0100
From: @njnes

Changeset 1a10469e62a2 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=1a10469e62a2

Changeset description:

fixed bug #3186

Comment 18370

Date: 2013-01-22 09:29:11 +0100
From: @sjoerdmullender

Oct2012-SP3 has been released.

@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Nov 9, 2022
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