List:Commits« Previous MessageNext Message »
From:Dmitry Lenev Date:November 30 2010 8:31am
Subject:bzr commit into mysql-trunk-bugfixing branch (Dmitry.Lenev:3392) Bug#27480
View as plain text  
#At file:///home/dlenev/src/bzr/mysql-trunk-bugfixing-bug27480/ based on revid:alexander.nozdrin@stripped

 3392 Dmitry Lenev	2010-11-30
      Prerequisite patch for Bug#27480 (Extend CREATE TEMPORARY TABLES
      privilege to allow temp table operations).
      
      Review fixes in progress.

    modified:
      sql/sp_head.cc
      sql/sql_view.cc
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc	2010-11-29 14:13:07 +0000
+++ b/sql/sp_head.cc	2010-11-30 08:30:48 +0000
@@ -2952,9 +2952,6 @@ sp_lex_keeper::reset_lex_and_exec_core(T
   reinit_stmt_before_use(thd, m_lex);
 
   if (open_tables)
-    res= open_and_process_temporary_table_list(thd, m_lex->query_tables);
-
-  if (!res && open_tables)
     res= instr->exec_open_and_lock_tables(thd, m_lex->query_tables);
 
   if (!res)
@@ -3044,8 +3041,9 @@ int sp_instr::exec_open_and_lock_tables(
     Check whenever we have access to tables for this statement
     and open and lock them before executing instructions core function.
   */
-  if (check_table_access(thd, SELECT_ACL, tables, FALSE, UINT_MAX, FALSE)
-      || open_and_lock_tables(thd, tables, TRUE, 0))
+  if (open_and_process_temporary_table_list(thd, tables) ||
+      check_table_access(thd, SELECT_ACL, tables, FALSE, UINT_MAX, FALSE) ||
+      open_and_lock_tables(thd, tables, TRUE, 0))
     result= -1;
   else
     result= 0;

=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc	2010-11-29 14:13:07 +0000
+++ b/sql/sql_view.cc	2010-11-30 08:30:48 +0000
@@ -441,6 +441,12 @@ bool mysql_create_view(THD *thd, TABLE_L
     goto err;
   }
 
+  /*
+    Open matching temporary tables for table list elements added by
+    prelocking algorithm. We need this in order to catch cases when
+    view uses functions that use temporary tables (note that this
+    check is not robust).
+  */
   if (open_and_process_temporary_table_list(thd, lex->query_tables))
   {
     res= TRUE;


Attachment: [text/bzr-bundle] bzr/dmitry.lenev@oracle.com-20101130083048-is634uoi3h04egsg.bundle
Thread
bzr commit into mysql-trunk-bugfixing branch (Dmitry.Lenev:3392) Bug#27480Dmitry Lenev30 Nov