Bug #117754 Row counts differ with and without an index for same table.
Submitted: 20 Mar 7:48 Modified: 20 Mar 9:40
Reporter: wang jack Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S2 (Serious)
Version:8.4.1 9.1.0 , 8.4.4, 8.0.41 OS:Windows (windows 11)
Assigned to: CPU Architecture:x86 (x86_64)

[20 Mar 7:48] wang jack
Description:
After running some sqls, the row counts retrieved from the same table are inconsistent.

mysql> SELECT t0.c0 FROM t0 WHERE ((-374729969)<<( EXISTS (SELECT 1 WHERE FALSE)));
+-----------+
| c0        |
+-----------+
| P{}^      |
| .?C!輠^?? |
|           |
|           |
+-----------+
4 rows in set (0.00 sec)

mysql> SELECT (((-374729969)<<( EXISTS (SELECT 1 WHERE FALSE)))) FROM t0;
+----------------------------------------------------+
| (((-374729969)<<( EXISTS (SELECT 1 WHERE FALSE)))) |
+----------------------------------------------------+
|                               18446744073334821647 |
|                               18446744073334821647 |
|                               18446744073334821647 |
|                               18446744073334821647 |
|                               18446744073334821647 |
|                               18446744073334821647 |
+----------------------------------------------------+
6 rows in set (0.00 sec)

mysql> EXPLAIN FORMAT=TREE SELECT t0.c0 FROM t0 WHERE ((-374729969)<<( EXISTS (SELECT 1 WHERE FALSE)));
+------------------------------------------+
| EXPLAIN                                  |
+------------------------------------------+
| -> Table scan on t0  (cost=0.65 rows=4)
 |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> EXPLAIN FORMAT=TREE SELECT (((-374729969)<<( EXISTS (SELECT 1 WHERE FALSE)))) FROM t0;
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| EXPLAIN                                                                                                                                                                 |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| -> Covering index scan on t0 using i0  (cost=0.65 rows=4)
-> Select #2 (subquery in projection; run only once)
    -> Zero rows (Impossible WHERE)  (cost=0..0 rows=0)
 |
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

How to repeat:
SELECT t0.c0 FROM t0 WHERE ((-374729969)<<( EXISTS (SELECT 1 WHERE FALSE)));
SELECT (((-374729969)<<( EXISTS (SELECT 1 WHERE FALSE)))) FROM t0;

Execute the statements in the repeat.sql file, then run the query above.
[20 Mar 9:40] MySQL Verification Team
Hello wang jack,

Thank you for the report and test case.
Verified as described.

regards,
Umesh