1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-16820 Lost 'Impossible where' from query with inexpensive subquery

This patch fixes another problem introduced by the patch for mdev-4817.
The latter changed Item_cond::fix_fields() in such a way that it could
call the virtual method is_expensive(). With the first its call
the method saves the result in Item::is_expensive_cache. For all next
calls the method returns the result from this cache. So if the item
once was determined as expensive the method always returns true.
For subqueries it's not good, because non-optimized subqueries always
is considered as expensive.
It means that the cache should be invalidated after the call of
optimize_constant_subqueries().
This commit is contained in:
Igor Babaev
2018-07-24 23:45:55 -07:00
parent 1bda5e3a8f
commit c631060713
9 changed files with 123 additions and 0 deletions

View File

@ -1207,6 +1207,13 @@ TODO: make view to decide if it is possible to write to WHERE directly or make S
if (optimize_constant_subqueries())
DBUG_RETURN(1);
if (conds && conds->has_subquery())
(void) conds->walk(&Item::cleanup_is_expensive_cache_processor,
0, (uchar*)0);
if (having && having->has_subquery())
(void) having->walk(&Item::cleanup_is_expensive_cache_processor,
0, (uchar*)0);
if (setup_jtbm_semi_joins(this, join_list, &conds))
DBUG_RETURN(1);