[MDEV-3873] Wrong result (extra rows) with NOT IN and a subquery from a MERGE view Created: 2012-11-21 Updated: 2013-09-25 Resolved: 2013-02-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.0, 5.5.28, 5.3.10 |
| Fix Version/s: | 10.0.1, 5.5.29, 5.3.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
The test case below returns different results when a query is run with a MERGE view comparing to a TEMPTABLE view or a base table. I believe that the TEMPTABLE/base table result is correct, even although the result with the MERGE view might look more "natural". The difference seems fresh, it appeared in maria/5.3 tree since revno 3592. Test case:
Results from maria/5.3 revno 3599:
Default optimizer_switch:
EXPLAINs (with the default optimizer switch):
|
| Comments |
| Comment by Elena Stepanova [ 2012-11-21 ] |
|
While the problem is not related to the change introduced in |
| Comment by Oleksandr Byelkin [ 2012-11-22 ] |
|
Correct explain for substituted view should be like this: i.e. possibility of NULLs in left join processed incorrectly (was not detected). |
| Comment by Oleksandr Byelkin [ 2012-11-22 ] |
|
In case of view TABLE_LIST::outer_join of merged table (tv in the example) is not set, so TABLE::maybe_null al;so is not set in setup_table_map() |
| Comment by Oleksandr Byelkin [ 2012-11-23 ] |
|
The question is: "Why merge algorithm for view/derived does not set embedding?" |
| Comment by Igor Babaev [ 2012-11-23 ] |
|
Apparently the merge algorithm should have set embedding. I would say this is a bug if it does not do it. |
| Comment by Oleksandr Byelkin [ 2012-11-26 ] |
|
the problem is that TABLE_LIST::wrap_into_nested_join sets embedding after setup_table_map where embedding is checked |
| Comment by Oleksandr Byelkin [ 2012-11-29 ] |
|
I have to talk With Igor about it. |
| Comment by Oleksandr Byelkin [ 2012-12-05 ] |
|
According to the advice I'll try to re-cqalculate TABLE::maybe_null after TABLE_LIST::wrap_into_nested_join calls... |
| Comment by Oleksandr Byelkin [ 2012-12-05 ] |
|
mysql_derived_merge() sets table->maybe_null but it is too late... |
| Comment by Oleksandr Byelkin [ 2012-12-11 ] |
|
just for note, derived works also incorrectly: |
| Comment by Oleksandr Byelkin [ 2012-12-12 ] |
|
Commited for review. |
| Comment by Oleksandr Byelkin [ 2013-01-21 ] |
|
Pushed fix for 5.5. |
| Comment by Oleksandr Byelkin [ 2013-01-22 ] |
|
Fixed in 5.5 (typo & test suite) |
| Comment by Oleksandr Byelkin [ 2013-01-22 ] |
|
only 10.0 left waiting to merge |