[MDEV-5515] 2nd execution of a prepared statement returns wrong results Created: 2014-01-10 Updated: 2014-01-29 Resolved: 2014-01-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.3.12, 5.5.34, 10.0.6 |
| Fix Version/s: | 5.5.35, 10.0.8, 5.3.13 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Georg Richter | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
All |
||
| Description |
|
When executing a prepared statement twicce, second execution returns invalid results. How to repeat:
Output:
|
| Comments |
| Comment by Oleksandr Byelkin [ 2014-01-13 ] |
|
It could be duplicate of |
| Comment by Oleksandr Byelkin [ 2014-01-13 ] |
|
NO, it is not duplicate. |
| Comment by Oleksandr Byelkin [ 2014-01-13 ] |
|
IF() has the same problem, GREATEST() has more interesting result: |
| Comment by Oleksandr Byelkin [ 2014-01-13 ] |
|
Adding fields to SELECT list of the query fixes the problem, so probably read flags set incorrectly during second execution. |
| Comment by Oleksandr Byelkin [ 2014-01-13 ] |
|
according to EXPLAIN EXTENDED ON expression lost on second execution: |
| Comment by Oleksandr Byelkin [ 2014-01-13 ] |
|
eliminate_tables() got wrong used tables map from SELECT item list (6 instead of 12) on second execution |
| Comment by Oleksandr Byelkin [ 2014-01-13 ] |
|
it looks like lack of update_used_tables() after handling derived tables |
| Comment by Oleksandr Byelkin [ 2014-01-13 ] |
|
Patch sent for review. |
| Comment by Sergei Petrunia [ 2014-01-14 ] |
|
Debugging the example, I see: (gdb) p join->fields_list.head() (gdb) p *join->fields_list.head()->ref (gdb) p *(*join->fields_list.head() This is probably not related to this bug, but why is one Item_direct_view_ref |
| Comment by Daniel Bartholomew [ 2014-01-29 ] |
|
http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/2502.567.182 |