summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.home>2007-03-13 21:15:29 +0300
committerunknown <kroki/tomash@moonlight.home>2007-03-13 21:15:29 +0300
commitfa57a563ce66f4b024da4b50ea4109bf0d45e202 (patch)
tree251d8dbd531fd0a22f50781b251258c536d19ddb /sql
parentfa2791a35c025b52ebfe9574526ed826c91f42cb (diff)
downloadmariadb-git-fa57a563ce66f4b024da4b50ea4109bf0d45e202.tar.gz
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().
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_prepare.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 109c03742d1..292f9ebd344 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -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;