From: Dmitry Lenev Date: December 3 2010 6:42am Subject: bzr commit into mysql-trunk-bugfixing branch (Dmitry.Lenev:3397) Bug#27480 List-Archive: http://lists.mysql.com/commits/125888 X-Bug: 27480 Message-Id: <20101203064238.6DA1CE58F6@mockturtle> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1495060034==" --===============1495060034== MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline #At file:///home/dlenev/src/bzr/mysql-trunk-bugfixing-bug27480/ based on revid:dmitry.lenev@stripped 3397 Dmitry Lenev 2010-12-03 Prerequisite patch for Bug#27480 (Extend CREATE TEMPORARY TABLES privilege to allow temp table operations). Review fixes in progress. Fixed merge.test failures. modified: sql/sql_admin.cc sql/sql_base.cc storage/myisammrg/ha_myisammrg.cc === modified file 'sql/sql_admin.cc' --- a/sql/sql_admin.cc 2010-12-01 10:07:22 +0000 +++ b/sql/sql_admin.cc 2010-12-03 06:42:19 +0000 @@ -293,9 +293,11 @@ static bool mysql_admin_table(THD* thd, /* Close all temporary tables which were pre-open to simplify - privilege checking. + privilege checking. Clear all references to closed tables. */ close_thread_tables(thd); + for (table= tables; table; table= table->next_local) + table->table= NULL; for (table= tables; table; table= table->next_local) { === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2010-12-02 06:57:30 +0000 +++ b/sql/sql_base.cc 2010-12-03 06:42:19 +0000 @@ -4345,20 +4345,20 @@ open_and_process_table(THD *thd, LEX *le */ error= open_and_process_temporary_table(thd, tables); - if (!error && !tables->table) - { - /* - For the tables added by the pre-locking code, attempt to open - the table but fail silently if the table does not exist. - The real failure will occur when/if a statement attempts to use - that table. - */ - No_such_table_error_handler no_such_table_handler; - thd->push_internal_handler(&no_such_table_handler); - error= open_table(thd, tables, new_frm_mem, ot_ctx); - thd->pop_internal_handler(); - safe_to_ignore_table= no_such_table_handler.safely_trapped_errors(); - } + if (error || tables->table) + goto end; + + /* + For the tables added by the pre-locking code, attempt to open + the table but fail silently if the table does not exist. + The real failure will occur when/if a statement attempts to use + that table. + */ + No_such_table_error_handler no_such_table_handler; + thd->push_internal_handler(&no_such_table_handler); + error= open_table(thd, tables, new_frm_mem, ot_ctx); + thd->pop_internal_handler(); + safe_to_ignore_table= no_such_table_handler.safely_trapped_errors(); } else error= open_table(thd, tables, new_frm_mem, ot_ctx); === modified file 'storage/myisammrg/ha_myisammrg.cc' --- a/storage/myisammrg/ha_myisammrg.cc 2010-10-20 19:02:59 +0000 +++ b/storage/myisammrg/ha_myisammrg.cc 2010-12-03 06:42:19 +0000 @@ -479,6 +479,11 @@ int ha_myisammrg::add_children_list(void child_l->set_table_ref_id(mrg_child_def->get_child_table_ref_type(), mrg_child_def->get_child_def_version()); /* + Copy parent's prelocking attribute to allow opening of child + temporary residing in the prelocking list. + */ + child_l->prelocking_placeholder= parent_l->prelocking_placeholder; + /* For statements which acquire a SNW metadata lock on a parent table and then later try to upgrade it to an X lock (e.g. ALTER TABLE), SNW locks should be also taken on the children tables. --===============1495060034== MIME-Version: 1.0 Content-Type: text/bzr-bundle; charset="us-ascii"; name="bzr/dmitry.lenev@stripped" Content-Transfer-Encoding: 7bit Content-Disposition: inline # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: dmitry.lenev@stripped # target_branch: file:///home/dlenev/src/bzr/mysql-trunk-bugfixing-\ # bug27480/ # testament_sha1: 808f351a7c8b600ae7d6923abbe7719158decce5 # timestamp: 2010-12-03 09:42:38 +0300 # source_branch: file:///home/dlenev/src/bzr/mysql-trunk-bugfixing/ # base_revision_id: dmitry.lenev@stripped\ # wjjmdal1a3qsbmy5 # # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWXu8Nw0AAxvfgFAQWff//38H 3iC////0YAdX3vd68KiBiCm2aA9FJGGSTTTIk9TR6aJ6NNT0m0I0NMg2k0ABmoEpBTGhpoCehU3l R6T01PUA00NMg9QGg0KQmNTaT1NpNNGgMhphMg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