Bug #48772 Workbench should display the # of updated rows when an UPDATE command is run
Submitted: 14 Nov 2009 4:40 Modified: 16 Sep 2010 15:30
Reporter: Chris Calender Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S4 (Feature request)
Version:5.2 OS:Any
Assigned to: Mike Lischke CPU Architecture:Any
Tags: UPDATE, updated rows, workbench

[14 Nov 2009 4:40] Chris Calender
Description:
MySQL Workbench should display the # of updated rows when an UPDATE command is run.

Currently, if you run an UPDATE in WB 5.2, the number of updated rows is not displayed anywhere.

However, it should not just display the number of "rows affected" as Query Browser currently does.  But rather, it should display the number of "rows matched" and the number "changed", as the MySQL client displays.

For example, from an UPDATE using a JOIN, you might see this output from in the MySQL command line client:

Query OK, 5 rows affected (0.00 sec)
Rows matched: 6  Changed: 5  Warnings: 0

This is sometimes important information, and so it should be dislayed somewhere within Workbench.

Note that the same UPDATE query run in Query Browser would only display:

"5 rows affected by the last command, no resultset returned"

How to repeat:
create table t1 ( id int(2), status char(10));
insert into t1 values (1,'BOGUS'),(2,'BOGUS'),(3,'BOGUS'),(4,'BOGUS'),(5,'BOGUS'),(6,'OKAY');
create table t2 ( id int(2));
insert into t2 select id from t1;

Now, execute the following query:

update t1
join t2
ON t1.id = t2.id
set t1.status = 'OKAY';

In Workbench, you will see nothing about the rows updated.

If run from the MySQL command line interface, you will see:

Query OK, 5 rows affected (0.00 sec)
Rows matched: 6  Changed: 5  Warnings: 0

And if run from Query Browser, you will see:

"5 rows affected by the last command, no resultset returned"

Suggested fix:
Make the output display what you would see if you executed the statement from within the MySQL command line interface.
[25 Jun 2010 14:44] Mike Lischke
Number of affected rows is already displayed, however the number of matched and changed rows is something that must be separately determined (the server/connector) does not return that info (what's the difference between affected and changed rows actually?).
[28 Jun 2010 21:47] Chris Calender
You're correct - three is no difference between "changed" rows and "affected" rows.  That is my mistake there, as I meant to say "matched" rows in the title.

Workbench does indeed return the changed/affected rows, but it does not include the "Rows matched", whereas the MySQL CLI does.

You mentioned the server does not return this information, but since the MySQL CLI returns this information, it would seem that WB could too.
[30 Aug 2010 12:51] Alfredo Kojima
The Rows matched line is returned by the server and can be fetched with mysql_info()
[2 Sep 2010 15:00] Mike Lischke
Fixed in repository
[14 Sep 2010 7:05] Johannes Taxacher
fix confirmed in repository
[16 Sep 2010 15:30] Tony Bedford
An entry has been added to the 5.2.28 changelog:

The SQL Editor did not display the number of rows matched after a query.

MySQL Workbench has been updated to ensure this information is displayed.