Bug #4905 Stored procedure doesn't clear for "Rows affected"
Submitted: 5 Aug 2004 1:00 Modified: 29 Sep 2004 16:57
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Bugs System CPU Architecture:Any

[5 Aug 2004 1:00] Peter Gulutzan
Description:
I make a stored procedure which, after the first time, cannot affect any rows, because I'm 
always inserting the same value for a primary key. There is a continue handler so there's 
no error return. But the following display is always "Query OK, 1 row affected (0.00 sec)".  
That cannot be, because 0 rows are affected. 
 

How to repeat:
mysql> delimiter // 
mysql> create table t (s1 int,primary key (s1))// 
Query OK, 0 rows affected (0.28 sec) 
 
mysql> create procedure piw () begin declare v int; declare continue handler for sqlstate 
'23000' set v = 5; insert into t values (1); end;// 
Query OK, 0 rows affected (0.34 sec) 
 
mysql> call piw()// 
Query OK, 1 row affected (0.00 sec) 
 
mysql> call piw()// 
Query OK, 1 row affected (0.00 sec) 
 
mysql> call piw()// 
Query OK, 1 row affected (0.01 sec) 
 
mysql> call piw()// 
Query OK, 1 row affected (0.00 sec) 
 
mysql> call piw()// 
Query OK, 1 row affected (0.01 sec) 
 
mysql> select * from t// 
+----+ 
| s1 | 
+----+ 
|  1 | 
+----+ 
1 row in set (0.00 sec) 
 
mysql> insert into t values (1)// 
ERROR 1062 (23000): Duplicate entry '1' for key 1 
 
mysql> call piw()// 
Query OK, 0 rows affected (0.00 sec)
[6 Aug 2004 3:07] MySQL Verification Team
Verified against latest 5.0 BK tree.
[29 Sep 2004 16:57] Per-Erik Martin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html