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

Description

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

1 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

1 2 3 4 5 6 7 8 9 10 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');

Environment

openbsd, windows

Status

Assignee

Alexander Barkov

Reporter

MartinL

Labels

External issue ID

None

External issue ID

None

Components

Sprint

None

Fix versions

Affects versions

10.1
10.1.8

Priority

Critical