diff options
author | unknown <gshchepa/uchum@gleb.loc> | 2007-07-19 18:39:01 +0500 |
---|---|---|
committer | unknown <gshchepa/uchum@gleb.loc> | 2007-07-19 18:39:01 +0500 |
commit | 36f1e4848ca0ddebe60b98286291057bb3d5e314 (patch) | |
tree | ea2a8315a5b624a4976fad41833c8898a032cbd9 /sql/item_func.cc | |
parent | 85603b2e0b6b51c57de7019f451461e676c458de (diff) | |
download | mariadb-git-36f1e4848ca0ddebe60b98286291057bb3d5e314.tar.gz |
Fixed bug #29338.
Optimization of queries with DETERMINISTIC functions in the
WHERE clause was not effective: sequential scan was always
used.
Now a SF with the DETERMINISTIC flags is treated as constant
when it's arguments are constants (or a SF doesn't has arguments).
sql/item_func.h:
Fixed bug #29338.
The Item_func_sp::used_tables has been removed
(virtual Item_func::used_tables function is enough).
The virtual Item_func_sp::update_used_tables function
has been added.
sql/item_func.cc:
Fixed bug #29338.
The Item_func_sp::update_used_tables and the
Item_func_sp::fix_field functions have been modified
to take into account the DETERMINISTIC flag of SF definition.
mysql-test/r/sp.result:
Updated test case for bug #29338.
mysql-test/t/sp.test:
Updated test case for bug #29338.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index b256ce4624a..e05f0a45083 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5591,5 +5591,15 @@ Item_func_sp::fix_fields(THD *thd, Item **ref) #endif /* ! NO_EMBEDDED_ACCESS_CHECKS */ } + if (!m_sp->m_chistics->detistic) + used_tables_cache |= RAND_TABLE_BIT; DBUG_RETURN(res); } + + +void Item_func_sp::update_used_tables() +{ + Item_func::update_used_tables(); + if (!m_sp->m_chistics->detistic) + used_tables_cache |= RAND_TABLE_BIT; +} |