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

(NULLIF(count(table.col)), 0) gives wrong result on 10.1.x

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.1.8, 10.1(EOL)
    • 10.1.11
    • Optimizer
    • openbsd, windows
    • 10.1.10, 10.1.11

    Description

      I have 4 rows in col1, yet maria 10.1 says on

      select nullif(count(`lame`.`col1`),0) from lame

      that I have 7.
      maria 10.0 and mysql gives 4 here.

      changing to ifnull instead of nullif works fine.

      To recreate this simple bug just use that line on anything you have or to recreate my testdb see below

      CREATE TABLE IF NOT EXISTS `lame` (
        `col1` varchar(50) DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
       
      /*!40000 ALTER TABLE `lame` DISABLE KEYS */;
      INSERT INTO `lame` (`col1`) VALUES
              ('hello'),
              ('hello\r\n'),
              ('hello'),
              ('hello');

      Attachments

        Activity

          People

            bar Alexander Barkov
            sopparus sippanson bernt
            Votes:
            6 Vote for this issue
            Watchers:
            12 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 1h
                1h

                Git Integration

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