-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-26940 Item_cond::remove_eq_conds leaves corrupt Item_equal #5360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 10.11
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3481,7 +3481,11 @@ class Item_equal: public Item_bool_func | |
| Item *f1, Item *f2, bool with_const_item); | ||
| Item_equal(THD *thd, Item_equal *item_equal); | ||
| /* Currently the const item is always the first in the list of equal items */ | ||
| inline Item* get_const() { return with_const ? equal_items.head() : NULL; } | ||
| inline Item* get_const() | ||
| { | ||
| DBUG_ASSERT(!with_const || equal_items.head()->const_item()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original implementation implied that Should the assertion instead be something like:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we could ever get an empty |
||
| return with_const ? equal_items.head() : NULL; | ||
| } | ||
| void add_const(THD *thd, Item *c); | ||
| /** Add a non-constant item to the multiple equality */ | ||
| void add(Item *f, MEM_ROOT *root) { equal_items.push_back(f, root); } | ||
|
|
@@ -3614,6 +3618,7 @@ template <template<class> class LI, typename T> class Item_equal_iterator | |
| { | ||
| LI<T> *list_it= this; | ||
| curr_item= (*list_it)++; | ||
| DBUG_ASSERT(curr_item && curr_item->const_item()); | ||
| } | ||
| } | ||
| Item* operator++(int) | ||
|
|
@@ -3627,7 +3632,10 @@ template <template<class> class LI, typename T> class Item_equal_iterator | |
| LI<T> *list_it= this; | ||
| list_it->rewind(); | ||
| if (item_equal->with_const) | ||
| { | ||
| curr_item= (*list_it)++; | ||
| DBUG_ASSERT(curr_item && curr_item->const_item()); | ||
| } | ||
| } | ||
| Field *get_curr_field() | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to use
List_iterator_fasthere instead because you're walking the list and updating elements in the list but not mutating the list itself.List_iterator_fastavoids some extra bookkeeping on the presumption that you're not altering the list itself.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch, thanks.