[MDEV-9550] COUNT(NULL) returns incorrect result with sequence storage engine Created: 2016-02-11  Updated: 2016-02-23  Resolved: 2016-02-23

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Sequence
Affects Version/s: 10.2
Fix Version/s: 10.1.12

Type: Bug Priority: Major
Reporter: Sergei Petrunia Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.1.12

 Description   

"Storage engine handles GROUP BY" optimization in Sequence SE returns incorrect value for COUNT(NULL):

MariaDB [test]> select * from seq_1_to_3;
+-----+
| seq |
+-----+
|   1 |
|   2 |
|   3 |
+-----+
 
MariaDB [test]> select count(NULL) from seq_1_to_3;
+-------------+
| count(NULL) |
+-------------+
|           3 |
+-------------+

This is an incorrect result. For comparison:

create table t100 (a int);
insert into t100 values (1),(2),(3);
select count(NULL) from t100;
+-------------+
| count(NULL) |
+-------------+
|           0 |
+-------------+


Generated at Thu Feb 08 07:35:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.