diff options
Diffstat (limited to 'sql/item_cmpfunc.cc')
-rw-r--r-- | sql/item_cmpfunc.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 875aacec3bc..687aa7e192b 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -5657,13 +5657,17 @@ bool Item_func_like::fix_fields(THD *thd, Item **ref) if (!res2) return FALSE; // Null argument - const size_t len = res2->length(); - const char* first = res2->ptr(); - const char* last = first + len - 1; + const size_t len= res2->length(); + /* len must be > 2 ('%pattern%') heuristic: only do TurboBM for pattern_len > 2 */ + if (len <= 2) + return FALSE; + + const char* first= res2->ptr(); + const char* last= first + len - 1; if (len > MIN_TURBOBM_PATTERN_LEN + 2 && *first == wild_many && |