[MDEV-6231] Wrong result (extra rows) via cursor in a stored procedure Created: 2014-05-12 Updated: 2017-10-11 Resolved: 2017-10-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 5.5.37, 10.0.11 |
| Fix Version/s: | 5.5.49 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Sprint: | 5.5.44, 5.5.58 | ||||||||
| Description |
|
Initially reported as http://bugs.skysql.com/show_bug.cgi?id=429 Test case:
Actual result:
Expected result:
The problem appeared in 5.5 tree with the following revision:
|
| Comments |
| Comment by shin [ 2014-05-15 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Is this bug will be resolved on 5.5.3.8 ? | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Debugging, one can see that st_select_lex::update_correlated_cache() changes the subquery from correlated to uncorrelated on the second CALL statement. (gdb) p dbug_print_item(sl->master_unit()->item) Note: making PS instead of cursor and re-running it produces a correct result each time. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||
|
When we are in st_select_lex::update_correlated_cache() during the first CALL:
Everything is OK: the WHERE condition contains a reference to outside. This Some details about the condition:
(I am a little bit surprised that there is an Item_field that has | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2014-05-29 ] | ||||||||||||||||||||||||||||||||||||||||||
|
When we are in st_select_lex::update_correlated_cache() during the second CALL:
The condition's used_tables() doesn't include OUTER_REF_TABLE_BIT. This is Let's explore the details:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
It looks like fixed, checking when:
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2017-10-11 ] | ||||||||||||||||||||||||||||||||||||||||||
|
It was fixed somewhere before 5.5.49 (can't build earlier version) |