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
3396 Dmitry Lenev 2010-12-02
Prerequisite patch for Bug#27480 (Extend CREATE TEMPORARY
TABLES privilege to allow temp table operations).
Review fixes in progress. Fixed issues discovered by
flush_read_lock.test.
modified:
sql/sql_parse.cc
sql/sql_update.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.
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-bugfixing branch (Dmitry.Lenev:3396 to 3397)Bug#27480 | Dmitry Lenev | 3 Dec |