Bug #13406 DELETE FROM csv_table - wrong "affected rows"
Submitted: 22 Sep 2005 15:28 Modified: 2 Dec 2005 20:32
Reporter: Sergei Golubchik Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:
Assigned to: Sergei Golubchik CPU Architecture:Any

[22 Sep 2005 15:28] Sergei Golubchik
Description:
DELETE FROM csv_table - wrong "affected rows"

How to repeat:
mysql> create table t1 (a int) type=csv;
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> delete from t1;
Query OK, 2 rows affected (0.00 sec)

mysql> delete from t1;
Query OK, 2 rows affected (0.00 sec)
[22 Sep 2005 15:34] Jorge del Conde
I reproduced this under FC4 / 5.0.12bk
[29 Sep 2005 17:54] Patrick Galbraith
Also, 2 is the value when there are an arbitrary number of rows of data:

mysql> insert into tinatab values (1, 1);
Query OK, 1 row affected (1.63 sec)

mysql> insert into tinatab values (2, 2);
Query OK, 1 row affected (1.64 sec)

mysql> insert into tinatab values (3,3);
Query OK, 1 row affected (2.29 sec)

mysql> delete from tinatab;
Query OK, 2 rows affected (0.89 sec)
[29 Sep 2005 20:22] Patrick Galbraith
even more issues: records is never properly known in ha_tina. It's always 0, and delete_row gives the proper number of records deleted only because it's decrementing from 0, and records is a ha_rows type which is a ulong! The reason for 2 being returned is that records is hardcoded to 2 in ::info if records < 0, which it is.
[25 Oct 2005 20:52] Patrick Galbraith
https://intranet.mysql.com/worklog/Server-Sprint/?tid=2949

Add meta file to ha_tina. This will help keep trace of the number of rows in a table, to make this bug fixable.
[16 Nov 2005 0:37] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32294
[17 Nov 2005 21:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32387
[28 Nov 2005 8:35] Sergei Golubchik
fixed in 5.0.17
[2 Dec 2005 20:32] Paul DuBois
Noted in 5.0.17 changelog.