From: Date: November 3 2008 2:00pm Subject: bzr commit into mysql-5.1 branch (kristofer.pettersson:2690) Bug#29507 List-Archive: http://lists.mysql.com/commits/57688 X-Bug: 29507 Message-Id: <0K9R00884DGRAJ80@fe-emea-09.sun.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT #At file:///home/thek/Development/cpp/mysqlbzr/mysql-5.1-bug40386/ 2690 Kristofer Pettersson 2008-11-03 Bug#29507 TRUNCATE shows to many rows effected TRUNCATE TABLE for InnoDB tables returned a count showing an approximation of the number of rows affected to gain efficiency. Now the statement always returns 0 rows affected for clarity. modified: sql/sql_delete.cc per-file messages: sql/sql_delete.cc * Set row count to 0 if auto increment was reset which can happen if TRUNCATE TABLE was issued. === modified file 'sql/sql_delete.cc' --- a/sql/sql_delete.cc 2008-07-17 18:26:55 +0000 +++ b/sql/sql_delete.cc 2008-11-03 13:08:42 +0000 @@ -398,7 +398,11 @@ cleanup: free_underlaid_joins(thd, select_lex); if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error)) { - thd->row_count_func= deleted; + /* + If a TRUNCATE TABLE was issued, the number of rows should be reported as + zero since the exact number is unknown. + */ + thd->row_count_func= reset_auto_increment ? 0 : deleted; my_ok(thd, (ha_rows) thd->row_count_func); DBUG_PRINT("info",("%ld records deleted",(long) deleted)); }