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

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

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

          Transition Time In Source Status Execution Times
          Elena Stepanova made transition -
          Open Confirmed
          1d 20h 43m 1
          Alexander Barkov made transition -
          Confirmed In Progress
          21d 14h 49m 1
          Alexander Barkov made transition -
          Stalled In Progress
          4d 23h 4m 1
          Alexander Barkov made transition -
          In Progress In Review
          7h 53m 2
          Sergei Golubchik made transition -
          In Review Stalled
          35d 17h 46m 2
          Alexander Barkov made transition -
          Stalled Closed
          41m 52s 1

          People

            bar Alexander Barkov
            sopparus sippanson bernt
            Votes:
            6 Vote for this issue
            Watchers:
            12 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.