Commit 097b6440 authored by Sergey Petrunya's avatar Sergey Petrunya

MDEV-5600: Wrong result on 2nd execution of PS depending on the length of the query

- Item_direct_view_ref didn't clear its pointer to item_equal in ::cleanup.
- Some Item_direct_view_ref objects have statement lifetime (i.e. they
  survive across multiple EXECUTE commands). Item_equal objects live only for
  the duration of one EXECUTE. This caused Item_direct_view_ref to have a stale pointer,
  which could cause all sorts of effects. (In this bug's testcase it was pointing to
  the wrong Item_equal, causing wrong query result)
- Fixed by doing what Item_field::cleanup() does - don't keep item_equal pointer value.
- There is no testcase because the only testcase I've got is highly fragile (e.g. the
  bug will not show up if @@datadir is of the wrong length).
parent 84580f95
...@@ -3103,6 +3103,7 @@ class Item_direct_view_ref :public Item_direct_ref ...@@ -3103,6 +3103,7 @@ class Item_direct_view_ref :public Item_direct_ref
void cleanup() void cleanup()
{ {
null_ref_table= NULL; null_ref_table= NULL;
item_equal= NULL;
Item_direct_ref::cleanup(); Item_direct_ref::cleanup();
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment