[MDEV-28257] Wrong results in derived_view.test for reexuction of statement Created: 2022-04-07 Updated: 2023-11-28 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Prepared Statements |
| Affects Version/s: | 10.7.3, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10 |
| Fix Version/s: | 10.5, 10.6 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Michael Widenius | Assignee: | Dmitry Shulga |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | not-10.4 | ||
| Description |
|
This bug was introduced into 10.7, where I noticed the problem, in the merge commit f5c5f8e41ecd4d407022d3772ac43075c16824a5 (merge 10.5 -> 10.6) The test case of LP BUG#968720 shows wrong results. Here is an independent test case that shows the issue: CREATE TABLE t1 (a int, INDEX(a)); CREATE TABLE t2 (a int, INDEX(a)); explain INSERT INTO t1 SELECT a FROM (SELECT a FROM test.t1) AS s1 NATURAL JOIN t2 AS s2; PREPARE stmt FROM " truncate table t1; The last select has 4 result lines (correct) while the previous select has only 2 result lines. Note that in 10.7-selectivity, which is updated to latest 10.7 doesn't have this problem. |
| Comments |
| Comment by Oleksandr Byelkin [ 2022-04-21 ] | ||
|
On second execution the derived is not filled on optimize (and so do not filled at all)
| ||
| Comment by Oleksandr Byelkin [ 2022-04-21 ] | ||
|
On second execution for t1 table->file->stats.records is 2 (should be 1) | ||
| Comment by Oleksandr Byelkin [ 2022-04-21 ] | ||
|
actually it should be 2, i.e. the problem is that prepared for static table statement can not be executed for table which become non-constant | ||
| Comment by Oleksandr Byelkin [ 2022-04-22 ] | ||
|
10.4 has at first glance all the same but it build new temporary table during JOIN::optimize_statge2(). |