diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-21 09:01:01 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-04-21 09:01:01 +0300 |
commit | 80ed136e6dd4a021b1fc9b7bd7077bf989c3d247 (patch) | |
tree | cc24f0e4e9241920329865a1b66c1d086aaeaa9a /sql/item_cmpfunc.cc | |
parent | 675c22c065110be03a5fab82442d2c3dc32aefff (diff) | |
parent | a0588d54a20488b17a178244989e1abc5151a88a (diff) | |
download | mariadb-git-80ed136e6dd4a021b1fc9b7bd7077bf989c3d247.tar.gz |
Merge 10.4 into 10.5
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 4a134e99bfc..97c41373d12 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -5800,13 +5800,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 && |