Commit 7c9c5b7d authored by Kristofer Pettersson's avatar Kristofer Pettersson

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.
parent 54eaadf0
...@@ -398,7 +398,11 @@ cleanup: ...@@ -398,7 +398,11 @@ cleanup:
free_underlaid_joins(thd, select_lex); free_underlaid_joins(thd, select_lex);
if (error < 0 || (thd->lex->ignore && !thd->is_fatal_error)) 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); my_ok(thd, (ha_rows) thd->row_count_func);
DBUG_PRINT("info",("%ld records deleted",(long) deleted)); DBUG_PRINT("info",("%ld records deleted",(long) deleted));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment