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

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 10.1.8, 10.1
    • Fix Version/s: 10.1.11
    • Component/s: Optimizer
    • Labels:
    • Environment:
      openbsd, windows
    • Sprint:
      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

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

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration