mirror of
https://github.com/MariaDB/server.git
synced 2025-10-28 17:15:19 +03:00
- a fix for Bug#11458 "Prepared statement with subselects return random
data": remove the fix for another bug (8807) that
added OUTER_REF_TABLE_BIT to all subqueries that used a placeholder
to prevent their evaluation at prepare. As this bit hanged in
Item_subselect::used_tables_cache for ever, a constant subquery with
a placeholder was never evaluated as such, which caused wrong
choice of the execution plan for the statement.
- to fix Bug#8807 backport a better fix from 5.0
- post-review fixes.
mysql-test/r/ps.result:
Bug#11458: test results fixed
mysql-test/t/ps.test:
- add a test case for Bug#11458 "Prepared statement with subselects return
random data"
sql/item.cc:
- remove unnecessary Item_param::fix_fields
- fix Item_param::set_null to set item_type accordingly (safety:
Item_param should behave like a basic constant).
sql/item.h:
Remove Item_param::fix_fields
sql/item_subselect.h:
Remove no more existing friend.
sql/mysql_priv.h:
Add UNCACHEABLE_PREPARE to mark all subqueries as uncacheable if
in statement prepare (backport from 5.0).
sql/sql_lex.h:
Comment fixed.
sql/sql_parse.cc:
If in statement prepare, mark all subqueries as uncacheable (backport
from 5.0)
sql/sql_prepare.cc:
Switch off the uncacheable flag from all subqueries after statement
prepare is done (backport from 5.0)
This commit is contained in:
@@ -4123,6 +4123,14 @@ mysql_new_select(LEX *lex, bool move_down)
|
||||
select_lex->select_number= ++lex->thd->select_number;
|
||||
select_lex->init_query();
|
||||
select_lex->init_select();
|
||||
/*
|
||||
Don't evaluate this subquery during statement prepare even if
|
||||
it's a constant one. The flag is switched off in the end of
|
||||
mysql_stmt_prepare.
|
||||
*/
|
||||
if (lex->thd->current_arena->is_stmt_prepare())
|
||||
select_lex->uncacheable|= UNCACHEABLE_PREPARE;
|
||||
|
||||
if (move_down)
|
||||
{
|
||||
lex->subqueries= TRUE;
|
||||
|
||||
Reference in New Issue
Block a user