[MDEV-25671] MOD function returns wrong value? Created: 2021-05-13  Updated: 2021-05-22  Resolved: 2021-05-22

Status: Closed
Project: MariaDB Server
Component/s: Platform Windows
Affects Version/s: 10.5.9
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Luuk V Assignee: Daniel Black
Resolution: Not a Bug Votes: 0
Labels: need_feedback
Environment:

Windows



 Description   

output from the second statement below (`select * from integers group by i%3 ;`) should not return the value 3.

MariaDB [test]> select distinct i%3 from integers;
+------+
| i%3  |
+------+
|    0 |
|    1 |
|    2 |
+------+
3 rows in set (0.499 sec)
 
MariaDB [test]> select * from integers  group by i%3 ;
+---+--------------------------------------+
| i | t1                                   |
+---+--------------------------------------+
| 3 | a44c970b-aff2-11eb-8dec-00155dfdb341 |
| 1 | a19fcf11-aff2-11eb-8dec-00155dfdb341 |
| 2 | a389475c-aff2-11eb-8dec-00155dfdb341 |
+---+--------------------------------------+
3 rows in set (0.553 sec)
 
MariaDB [test]> select @@version;
+----------------+
| @@version      |
+----------------+
| 10.5.9-MariaDB |
+----------------+
1 row in set (0.000 sec)

Table definition:

CREATE TABLE `integers` (
  `i` int(11) NOT NULL,
  `t1` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`i`),
  KEY `integers_t1` (`t1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

Impression of contents of this table:

select min(i),max(i), count(*) from integers;
+--------+---------+----------+
| min(i) | max(i)  | count(*) |
+--------+---------+----------+
|      0 | 2097152 |  2097153 |
+--------+---------+----------+



 Comments   
Comment by Daniel Black [ 2021-05-13 ]

Your query select * from integers group by i%3 is returning i, not i % 3. Its still grouping correctly.

Comment by Luuk V [ 2021-05-22 ]

I did overlook that, please close this....

Generated at Thu Feb 08 09:39:28 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.