Bug #43605 ROW_COUNT() with UPDATE differentiate between 0 rows matched and 0 rows updated
Submitted: 12 Mar 2009 16:54
Reporter: Roger David Nay Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:Any OS:Any
Assigned to: CPU Architecture:Any

[12 Mar 2009 16:54] Roger David Nay
Description:
After and UPDATE currently the ROW_COUNT() function does not differentiate between 0 rows matched for update and 0 rows updated, see manual (it has the same behaviour as mysql_affected_rows - http://dev.mysql.com/doc/refman/5.0/en/mysql-affected-rows.html). To differentiate between the two conditions an extra SELECT statement is required that can create performance issues if the table is heavily used.

How to repeat:
N/A

Suggested fix:
Add a return value of -2 that signifies 0 rows matched for update. Leave -1 for no rows updated/delete/inserted.