summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-11-25 12:55:19 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2023-03-01 13:03:22 +0100
commitcf36ae5c03e90fa993cd636510fdb417ab4034af (patch)
tree26a03dc37d0a2e489f5528d630fbab980a350df8
parent87c3d50b4e13481d158a1468921a5d57f3e70a82 (diff)
downloadmariadb-git-cf36ae5c03e90fa993cd636510fdb417ab4034af.tar.gz
MDEV-26831 fallout: cache cleanup
Correct cache cleanup (cached field number also have to be reset).
-rw-r--r--sql/sql_base.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 5b76cc7f47d..595d9a45b26 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -6361,8 +6361,19 @@ find_field_in_tables(THD *thd, Item_ident *item,
Store the original table of the field, which may be different from
cur_table in the case of NATURAL/USING join.
*/
- item->cached_table= (!actual_table->cacheable_table || found) ?
- 0 : actual_table;
+ if (actual_table->cacheable_table /*(1)*/ && !found /*(2)*/)
+ {
+ /*
+ We have just found a field allowed to cache (1) and
+ it is not dublicate search (2).
+ */
+ item->cached_table= actual_table;
+ }
+ else
+ {
+ item->cached_table= NULL;
+ item->cached_field_index= NO_CACHED_FIELD_INDEX;
+ }
DBUG_ASSERT(thd->where);
/*