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 expressions with constants are not evaluated correctly #3932

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

CASE expressions with constants are not evaluated correctly #3932

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

Comments

@monetdb-team
Copy link

Date: 2016-02-25 09:56:44 +0100
From: Arno Mittelbach <<arno.mittelbach>>
To: SQL devs <>
Version: 11.21.13 (Jul2015-SP2)

Last updated: 2016-03-25 09:59:18 +0100

Comment 21821

Date: 2016-02-25 09:56:44 +0100
From: Arno Mittelbach <<arno.mittelbach>>

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
Build Identifier:

For preparation consider the following simple table with one entry.

Create table a (a varchar(5), b varchar(10));
insert into a values ('12345','1234567890');

Now, the following statement outputs, as expected, 1234567890:

SELECT CASE WHEN 1=2 THEN a ELSE b END from a;

Result: 1234567890

However, when putting in a constant value then MonetDb returns an odd result:

SELECT CASE WHEN 1=2 THEN a ELSE 'lala' END from a;

Result: Px?~

The result is even varying if you run the query multiple times.

Reproducible: Always

Steps to Reproduce:

  1. Create table a (a varchar(5), b varchar(10));
  2. insert into a values ('12345','1234567890');
  3. SELECT CASE WHEN 1=2 THEN a ELSE 'lala' END from a;

Actual Results:

Px?~

Expected Results:

'lala'

As CASE expressions are quite standard and this may lead to wrong results I've set the Severity to critical.

Comment 21831

Date: 2016-02-26 15:47:19 +0100
From: MonetDB Mercurial Repository <>

Changeset 200c19adf549 made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

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

Changeset description:

Use VALptr instead of getArgReference to get correct indirection.
This fixes bug #3932.
Also added test.

Comment 21832

Date: 2016-02-26 15:47:37 +0100
From: @sjoerdmullender

Fixed.

Comment 21959

Date: 2016-03-25 09:59:18 +0100
From: @sjoerdmullender

Jul2015-SP3 has been released.

@monetdb-team monetdb-team added bug Something isn't working major SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 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 major SQL
Projects
None yet
Development

No branches or pull requests

2 participants