Commit 9581921
committed
Bug#17600176: This query returns a row in 5.5 but not 5.6 or current 5.7
The problem query contains an IN subquery that is transformed to
a semi-join. The subquery contains an outer join operation.
When run standalone, the outer join in the subquery is preserved as an
outer join and returns one row. However, when the full query is run,
the outer join is converted into an inner join, and the subquery no
longer returns any row. This causes the outer query to return no rows.
The problem is with the IF clause in the WHERE clause of the subquery,
When transforming into semi-join, we rely on Item::fix_after_pullout()
to adjust used_tables and not_null_tables information within the
condition objects, in order to determine e.g. the outer join to inner
join transform. However, there is no specific implementation of
::fix_after_pullout() for the IF clause, so it returns generic
information generated by Item_func::fix_after_pullout(). The fix is to
add this function.
By analysis, this appears to be a problem for BETWEEN predicates and
IN predicates too. A specific implementation of :;fix_after_pullout()
is added for both classes.
In addition, it was detected that not_null_tables information was not
updated correctly for class Item_row. However, I was not able to think
out any failing test for this problem, so no test case was added.1 parent 781df1f commit 9581921
3 files changed
Lines changed: 64 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2481 | 2481 | | |
2482 | 2482 | | |
2483 | 2483 | | |
2484 | | - | |
| 2484 | + | |
2485 | 2485 | | |
2486 | 2486 | | |
2487 | 2487 | | |
2488 | | - | |
| 2488 | + | |
2489 | 2489 | | |
2490 | 2490 | | |
2491 | 2491 | | |
| |||
2494 | 2494 | | |
2495 | 2495 | | |
2496 | 2496 | | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
2497 | 2513 | | |
2498 | 2514 | | |
2499 | 2515 | | |
| |||
2937 | 2953 | | |
2938 | 2954 | | |
2939 | 2955 | | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
2940 | 2965 | | |
2941 | 2966 | | |
2942 | 2967 | | |
| |||
4332 | 4357 | | |
4333 | 4358 | | |
4334 | 4359 | | |
4335 | | - | |
4336 | | - | |
| 4360 | + | |
4337 | 4361 | | |
4338 | | - | |
4339 | | - | |
4340 | 4362 | | |
4341 | | - | |
| 4363 | + | |
4342 | 4364 | | |
4343 | | - | |
| 4365 | + | |
4344 | 4366 | | |
4345 | | - | |
| 4367 | + | |
4346 | 4368 | | |
4347 | | - | |
| 4369 | + | |
4348 | 4370 | | |
4349 | | - | |
| 4371 | + | |
| 4372 | + | |
| 4373 | + | |
| 4374 | + | |
| 4375 | + | |
| 4376 | + | |
| 4377 | + | |
| 4378 | + | |
| 4379 | + | |
| 4380 | + | |
| 4381 | + | |
| 4382 | + | |
| 4383 | + | |
| 4384 | + | |
| 4385 | + | |
| 4386 | + | |
| 4387 | + | |
| 4388 | + | |
| 4389 | + | |
| 4390 | + | |
| 4391 | + | |
| 4392 | + | |
4350 | 4393 | | |
4351 | 4394 | | |
4352 | | - | |
4353 | 4395 | | |
4354 | 4396 | | |
4355 | 4397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
753 | 753 | | |
754 | 754 | | |
755 | 755 | | |
| 756 | + | |
| 757 | + | |
756 | 758 | | |
757 | 759 | | |
758 | 760 | | |
| |||
865 | 867 | | |
866 | 868 | | |
867 | 869 | | |
| 870 | + | |
| 871 | + | |
868 | 872 | | |
869 | 873 | | |
870 | 874 | | |
| |||
1410 | 1414 | | |
1411 | 1415 | | |
1412 | 1416 | | |
| 1417 | + | |
| 1418 | + | |
1413 | 1419 | | |
1414 | 1420 | | |
1415 | 1421 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
| 146 | + | |
| 147 | + | |
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
150 | 151 | | |
| 152 | + | |
151 | 153 | | |
152 | 154 | | |
153 | 155 | | |
| |||
0 commit comments