summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-08-23 16:15:57 +0200
committerunknown <guilhem@mysql.com>2004-08-23 16:15:57 +0200
commite9c25d9336c8d1266254df5f795366e7d280de85 (patch)
tree473c7951f1ebf8ee281da1848e8cadc3e2cf68e1 /sql/sql_delete.cc
parent38b8c98543e68b3185a491b3cb9fb9d48662ef14 (diff)
downloadmariadb-git-e9c25d9336c8d1266254df5f795366e7d280de85.tar.gz
Fix for BUG#5033 "When using temporary tables truncate does NOT reset the auto_increment counter"
(ok'd by CTO to fix it in 4.0). Fix to make mysql-test-run work with all Valgrind versions. mysql-test/mysql-test-run.sh: fixing mysql-test-run.sh so that it works indifferently with Valgrind 1.x, 2.x (versions <= 2.0.0 refuse --tool option; versions >=2.1.2 require it; 2.1.0 accepts it). I hope the shell code is portable enough; anyway Valgrind only runs on Linux... I tested it with 2.0.0, 2.1.0, 2.1.2. mysql-test/r/truncate.result: result update mysql-test/t/truncate.test: testing if TRUNCATE resets autoinc counter for temp tables (BUG#5033); testing difference with DELETE FROM. sql/sql_delete.cc: in mysql_truncate(), always reset the autoinc counter, as manual says (even if it's a temp table, which was BUG#5033).
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index b568166a766..555e63b9e32 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -545,15 +545,13 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
int error;
DBUG_ENTER("mysql_truncate");
+ bzero((char*) &create_info,sizeof(create_info));
/* If it is a temporary table, close and regenerate it */
if (!dont_send_ok && (table_ptr=find_temporary_table(thd,table_list->db,
table_list->real_name)))
{
TABLE *table= *table_ptr;
- HA_CREATE_INFO create_info;
table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK);
- bzero((char*) &create_info,sizeof(create_info));
- create_info.auto_increment_value= table->file->auto_increment_value;
db_type table_type=table->db_type;
strmov(path,table->path);
@@ -596,7 +594,6 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
DBUG_RETURN(-1);
}
- bzero((char*) &create_info,sizeof(create_info));
*fn_ext(path)=0; // Remove the .frm extension
error= ha_create_table(path,&create_info,1) ? -1 : 0;
query_cache_invalidate3(thd, table_list, 0);