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

IF THEN ELSEIF always evaluates the first test as true #3629

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

IF THEN ELSEIF always evaluates the first test as true #3629

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

Comments

@monetdb-team
Copy link

Date: 2014-11-27 19:58:26 +0100
From: Duncan Garmonsway <>
To: SQL devs <>
Version: 11.19.7 (Oct2014-SP1)
CC: @njnes

Last updated: 2015-01-29 14:07:09 +0100

Comment 20462

Date: 2014-11-27 19:58:26 +0100
From: Duncan Garmonsway <>

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.42 Safari/537.36
Build Identifier:

Reproducible: Always

Steps to Reproduce:

  1. monetdbd start monetdb
    nacnudus@nactop:% monetdb create test
    created database in maintenance mode: test
    nacnudus@nactop:
    % monetdb release test
    taken database out of maintenance mode: test
    nacnudus@nactop:~% mclient test
    user(nacnudus):monetdb
    password:
    Welcome to mclient, the MonetDB/SQL interactive terminal (Oct2014)
    Database: MonetDB v11.19.3 (Oct2014), 'mapi:monetdb://nactop:50000/test'
    Type \q to quit, ? for a list of available commands
    auto commit mode: on
    sql>CREATE FUNCTION test(b1 BOOLEAN)
    more>RETURNS INTEGER
    more>BEGIN
    more> IF b1 THEN RETURN 1;
    more> ELSEIF NOT(b1) THEN RETURN 0;
    more> ELSE RETURN NULL;
    more> END IF;
    more>END;
    operation successful (31.235ms)
    sql>SELECT test(true), test(false), test(null);

Actual Results:

+------+------+-------------------+
| L1 | L2 | test_single_value |
+======+======+===================+
| 1 | 1 | 1 |
+------+------+-------------------+
1 tuple (1.470ms)

Expected Results:

+------+------+-------------------+
| L1 | L2 | test_single_value |
+======+======+===================+
| 1 | 0 | null |
+------+------+-------------------+
1 tuple (1.470ms)

Comment 20493

Date: 2014-11-30 18:33:48 +0100
From: @njnes

properly generate the else parts and implement 3 value logic in else cases
Added test ifthenelse.Bug-3629

Comment 20494

Date: 2014-11-30 18:34:54 +0100
From: MonetDB Mercurial Repository <>

Changeset 091b184e5199 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=091b184e5199

Changeset description:

added test for bug #3629

Comment 20495

Date: 2014-11-30 18:36:15 +0100
From: MonetDB Mercurial Repository <>

Changeset a7b88bea38e6 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=a7b88bea38e6

Changeset description:

fixes for bug #3629

properly handle list of else parts
added 3 value logic in if then etc

Comment 20593

Date: 2015-01-29 14:07:09 +0100
From: @sjoerdmullender

Oct2014-SP2 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 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 normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants