From 02d692eb3bf2eadf40013f110e066aea143943fd Mon Sep 17 00:00:00 2001 From: "dlenev@mysql.com" <> Date: Wed, 10 May 2006 14:12:32 +0400 Subject: [PATCH] Follow-up for the patch for bugs #12472/#15137 "CREATE TABLE ... SELECT ... which explicitly or implicitly uses stored function gives 'Table not locked' error" Test case for these bugs crashed in --ps-protocol mode. The crash was caused by incorrect usage of check_grant() routine from create_table_precheck() routine. The former assumes that either number of tables to be inspected by it is limited explicitly (i.e. is is not UINT_MAX) or table list used and thd->lex->query_tables_own_last value correspond to each other. create_table_precheck() was not fulfilling this condition and crash happened. The fix simply sets number of tables to be inspected by check_grant() to 1. --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 649714315a6..abc945647bd 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7227,7 +7227,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables, lex->create_info.merge_list.first)) goto err; if (grant_option && want_priv != CREATE_TMP_ACL && - check_grant(thd, want_priv, create_table, 0, UINT_MAX, 0)) + check_grant(thd, want_priv, create_table, 0, 1, 0)) goto err; if (select_lex->item_list.elements)