Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-5963

The IF function returns a wrong value

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 23.10.3
    • None
    • FuncExp, MDB Plugin, PrimProc
    • None
    • 2025-7, 2025-8

    Description

      The IF function returns a wrong value when the first expression is FALSE, the second expression is NULL, the third expression is a datetime, and the table engine is Columnstore. See script below. The output is fine when using another store engine.

      drop table if exists FOO;
       
      create table FOO(foo datetime) engine = columnstore;
       
      insert into FOO(foo) values (curtime());
       
      select * from FOO;
      -- OK: 2025-04-07 12:59:34
       
      select if(0 = 1, curdate(), foo) from FOO;
      -- OK: 2025-04-07 12:59:34
       
      select if(0 = 1, null, foo) from FOO;
      -- NOT OK: 0000-00-00 00:00:00
      

      Attachments

        Activity

          People

            kristina Kristina Pavlova
            water P.R. Water
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.