Commit d334766
committed
Bug#22810883: ASSERTION FAILED: !(USED_TABS & (~READ_TABLES & ~FILTER_FOR_TABLE))
If the generation expression of an indexed generated column contains
an AND or OR expression, the optimizer may choose that index too often
and create execution plans that give wrong results.
The problem is that Item_cond::eq() does not inspect the arguments of
the AND or OR expression. It inspects the "args" member, but it is
always empty for Item_cond objects. They instead keep their arguments
in the member "list".
The result is that it always considers two AND expressions as equal.
Similarly, it always considers two OR expressions as equal. Because of
this, the optimizer may choose to replace an AND or OR expression, for
example in a WHERE clause, with a generated column that is not
equivalent to the replaced expression.
The fix is to change Item_cond::eq() to inspect the "list" member
instead of the "args" member.1 parent 83f46ae commit d334766
File tree
4 files changed
+136
-3
lines changed- mysql-test/suite/gcol
- inc
- r
- sql
4 files changed
+136
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
735 | 742 | | |
736 | 743 | | |
737 | 744 | | |
| |||
808 | 815 | | |
809 | 816 | | |
810 | 817 | | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
811 | 839 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1317 | 1317 | | |
1318 | 1318 | | |
1319 | 1319 | | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
1320 | 1338 | | |
1321 | 1339 | | |
1322 | 1340 | | |
| |||
1459 | 1477 | | |
1460 | 1478 | | |
1461 | 1479 | | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
| 1494 | + | |
| 1495 | + | |
| 1496 | + | |
| 1497 | + | |
| 1498 | + | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1462 | 1512 | | |
1463 | 1513 | | |
1464 | 1514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
890 | 908 | | |
891 | 909 | | |
892 | 910 | | |
| |||
1014 | 1032 | | |
1015 | 1033 | | |
1016 | 1034 | | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
1017 | 1067 | | |
1018 | 1068 | | |
1019 | 1069 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5871 | 5871 | | |
5872 | 5872 | | |
5873 | 5873 | | |
5874 | | - | |
| 5874 | + | |
5875 | 5875 | | |
5876 | 5876 | | |
5877 | | - | |
5878 | | - | |
| 5877 | + | |
| 5878 | + | |
| 5879 | + | |
| 5880 | + | |
| 5881 | + | |
| 5882 | + | |
| 5883 | + | |
5879 | 5884 | | |
5880 | 5885 | | |
5881 | 5886 | | |
| |||
0 commit comments