[MDEV-17201] dropped anchor rows with non-null recursion query Created: 2018-09-15 Updated: 2018-09-26 Resolved: 2018-09-26 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - CTE |
| Affects Version/s: | 10.3.9, 10.2 |
| Fix Version/s: | 10.2.18 |
| Type: | Bug | Priority: | Major |
| Reporter: | Daniel Black | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | cte, wrong_result | ||
| Description |
|
Query with empty recursive component:
correctly show the two expired fields:
however:
This drops the second row from the anchor query (p_id=1)
|
| Comments |
| Comment by Igor Babaev [ 2018-09-17 ] | |||||||||||||||||||||||||||||||||||||
|
The bug is reproducible in 10.2 as well (with the same test case). | |||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2018-09-18 ] | |||||||||||||||||||||||||||||||||||||
|
A fix for this bug was pushed into 10.2 | |||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2018-09-18 ] | |||||||||||||||||||||||||||||||||||||
|
Thanks for the fix igor | |||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2018-09-19 ] | |||||||||||||||||||||||||||||||||||||
|
There need to be another reset of the limit because even with the one fix so far, there should be at least one recursive result with p_id=1. Removing the LIMIT clause from the union parts does generate a more complete result. | |||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2018-09-25 ] | |||||||||||||||||||||||||||||||||||||
|
Daniel, | |||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2018-09-25 ] | |||||||||||||||||||||||||||||||||||||
|
If I take out the LIMIT clause on the test...
The test result is:
All these extra rows match p_pid=1 So with a LIMIT 1 clause, the following two rows (from above, the last is eliminated by the limit i think) with p_pid=1 should appear in the output:
| |||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2018-09-26 ] | |||||||||||||||||||||||||||||||||||||
|
Daniel, Here is how the rows are generated if LIMIT is not used:
The second iteration produces only 1 row with p_id=1. | |||||||||||||||||||||||||||||||||||||
| Comment by Daniel Black [ 2018-09-26 ] | |||||||||||||||||||||||||||||||||||||
|
I final understand. My error. Thanks for the detail. As I understand it now: After the first recursive query, the only results that are passed to the next iteration are the results of that first recursive query. In this test case, two initial anchor rows doesn't mean that each exists individually as a point from which recursion starts, both rows together are the one starting point. Ready to close. Mea Culpa. |