Commit fa57a563 authored by unknown's avatar unknown

Fix the bug introduced with the push of the fix for bug#18326: Do not

lock table for writing during prepare of statement.

When single call open_normal_and_derived_tables() was used, we never
set table_count to the right value.  This patch reverts the part of
the old code that does open_tables() (and sets table_count), then
checks if table_list->multitable_view is set (and returns if so, using
table_count value), and only then it does mysql_handle_derived().

parent fa2791a3
......@@ -1142,7 +1142,7 @@ static int mysql_test_update(Prepared_statement *stmt,
DBUG_ENTER("mysql_test_update");
if (update_precheck(thd, table_list) ||
open_normal_and_derived_tables(thd, table_list, 0))
open_tables(thd, &table_list, &table_count, 0))
goto error;
if (table_list->multitable_view)
......@@ -1155,6 +1155,13 @@ static int mysql_test_update(Prepared_statement *stmt,
DBUG_RETURN(2);
}
/*
thd->fill_derived_tables() is false here for sure (because it is
preparation of PS, so we even do not check it).
*/
if (mysql_handle_derived(thd->lex, &mysql_derived_prepare))
goto error;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
/* TABLE_LIST contain right privilages request */
want_privilege= table_list->grant.want_privilege;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment