Bug #118351 When Backward index scan is used for query SQL statements, the returned result is incorrect.
Submitted: 4 Jun 2:24 Modified: 4 Jun 6:34
Reporter: Alice Alice Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:8.0.41 OS:Linux
Assigned to: CPU Architecture:x86

[4 Jun 2:24] Alice Alice
Description:
mysql> select tinyint_col,id_col from tbl_1_all_typeindex_desc ignore index(ndx_tinyint_col) where tinyint_col IN (0,108,110,126,127,-128,16,25,38,42,50,61,74,87,98,NULL) group by 1,2 order by 1,2 limit 14 offset 2;
+-------------+--------+
| tinyint_col | id_col |
+-------------+--------+
|        -128 |     68 |
|        -128 |     69 |
|        -128 |     70 |
|           0 |     71 |
|           0 |     72 |
|           0 |     73 |
|           0 |     74 |
|           0 |     75 |
|           0 |     76 |
|           0 |     77 |
|           0 |     78 |
|           0 |     79 |
|           0 |     80 |
|           0 |     81 |
+-------------+--------+
14 rows in set (0.00 sec)

mysql> select tinyint_col,id_col from tbl_1_all_typeindex_desc force index(ndx_tinyint_col) where tinyint_col IN (0,108,110,126,127,-128,16,25,38,42,50,61,74,87,98,NULL) group by 1,2 order by 1,2 limit 14 offset 2;
+-------------+--------+
| tinyint_col | id_col |
+-------------+--------+
|        -128 |     68 |
|        -128 |     67 |
|        -128 |     66 |
|           0 |    108 |
|           0 |    107 |
|           0 |    106 |
|           0 |    105 |
|           0 |    104 |
|           0 |    103 |
|           0 |    102 |
|           0 |    101 |
|           0 |    100 |
|           0 |     99 |
|           0 |     98 |
+-------------+--------+
14 rows in set (0.00 sec)

How to repeat:
create database test;
use test;
source tbl_1_all_typeindex_desc.sql
select tinyint_col,id_col from tbl_1_all_typeindex_desc ignore index(ndx_tinyint_col) where tinyint_col IN (0,108,110,126,127,-128,16,25,38,42,50,61,74,87,98,NULL) group by 1,2 order by 1,2 limit 14 offset 2;
select tinyint_col,id_col from tbl_1_all_typeindex_desc force index(ndx_tinyint_col) where tinyint_col IN (0,108,110,126,127,-128,16,25,38,42,50,61,74,87,98,NULL) group by 1,2 order by 1,2 limit 14 offset 2;
[4 Jun 6:34] MySQL Verification Team
Hello Alice Alice,

Thank you for the report and feedback.

regards,
Umesh