From bb7e682809be8a627bcb594dbc0ae582a38819dc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 24 Mar 2006 22:46:33 +0300 Subject: [PATCH] Follow-up for the fix for bug #18153 "ALTER/OPTIMIZE/REPAIR on transactional tables corrupt triggers". It turned out that we also have relied at certain places that (new_table != table_name) were always true on Windows and for transactional tables. Since our fix for the bug brakes this assumption we have to add new flag to pass this information around. This code needs to be refactored but I dare not to do this in 5.0. sql/sql_table.cc: mysql_alter_table(): Follow-up for the fix for bug #18153 "ALTER/OPTIMIZE/REPAIR on transactional tables corrupt triggers". It turned out that we also have relied at certain places that (new_table != table_name) were always true on Windows and for transactional tables. Since our fix for the bug brakes this assumption we have to add new flag to pass this information around. This code needs to be refactored but I dare not to do this in 5.0. --- sql/sql_table.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index d7a37e67cd0..4975bbaaaf1 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3182,6 +3182,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, uint db_create_options, used_fields; enum db_type old_db_type,new_db_type; bool need_copy_table; + bool no_table_reopen= FALSE; DBUG_ENTER("mysql_alter_table"); thd->proc_info="init"; @@ -3833,6 +3834,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, */ close_cached_table(thd, table); table=0; // Marker that table is closed + no_table_reopen= TRUE; } #if (!defined( __WIN__) && !defined( __EMX__) && !defined( OS2)) else @@ -3871,7 +3873,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, VOID(pthread_mutex_unlock(&LOCK_open)); goto err; } - if (thd->lock || new_name != table_name) // True if WIN32 + if (thd->lock || new_name != table_name || no_table_reopen) // True if WIN32 { /* Not table locking or alter table with rename