Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-14458

CASE statement precision

    XMLWordPrintable

Details

    Description

      Description:
      Odd results when comparing the below query on MySQL 5.6 / 5.7 with Maria 10.0 - 10.2

      How to repeat:

      create table t1(a varchar(255));
      ALTER TABLE `t1` ADD FULLTEXT KEY `a` (`a`);
      insert into t1 values ("Install requirements");
       
      select MATCH(`a`) AGAINST ("Install unimaginative" IN NATURAL LANGUAGE MODE) from `t1`;
      select `a` from `t1` where case when true then MATCH(`a`) AGAINST ("Install unimaginative" IN NATURAL LANGUAGE MODE) end;
      

      Actual Results:
      Second SELECT query returns no results, yet on MySQL 5.6 / 5.7 it does (see: https://www.db-fiddle.com/f/tM2FxQMFrbjCThgW4oQE7X/1)

      Expected Results:
      Second SELECT query should return the "Install requirements" row

      Additional Information:
      Seems to work without the CASE statement:

      select `a` from `t1` where MATCH(`a`) AGAINST ("Install unimaginative" IN NATURAL LANGUAGE MODE)
      

      Seems to also work if you add > 0:

      select `a` from `t1` where case when true then MATCH(`a`) AGAINST ("Install unimaginative" IN NATURAL LANGUAGE MODE) end > 0;
      

      Attachments

        Activity

          People

            cvicentiu Vicențiu Ciorbaru
            kieran Kieran Brahney
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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