Unexpected response from UPDATE statement

Bug #1152432 reported by Asou Chang on 2013-03-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Spider for MySQL
Undecided
Unassigned

Bug Description

UPDATE statement's response would be different from standard MySQL when SET the same values to the matched row. The following showed the example.

===== Standard MySQL =====

mysql> select * from device where _SK_=27 and cid="f58ff20c-7da5-4657-8ae7-49957c2204b0" and did="i:e2f433cd6259f738274b4d431843e0042741b484"\G
*************************** 1. row ***************************
                     _SK_: 27
                      cid: f58ff20c-7da5-4657-8ae7-49957c2204b0
                      did: i:e2f433cd6259f738274b4d431843e0042741b484
                    score: 93.617

1 row in set (0.00 sec)

mysql> update device set score=93.617 where _SK_=27 and cid="f58ff20c-7da5-4657-8ae7-49957c2204b0" and did="i:e2f433cd6259f738274b4d431843e0042741b484";
Query OK, 0 rows affected (0.01 sec)
Rows matched: 1 Changed: 0 Warnings: 0

When updating score to the same/original value, MySQL would response 1 matched and 0 changed. However, in the mysql-spider

===== Spider MySQL =====

mysql> select * from device where _SK_=27 and cid="f58ff20c-7da5-4657-8ae7-49957c2204b0" and did="i:e2f433cd6259f738274b4d431843e0042741b484"\G
*************************** 1. row ***************************
                     _SK_: 27
                      cid: f58ff20c-7da5-4657-8ae7-49957c2204b0
                      did: i:e2f433cd6259f738274b4d431843e0042741b484
                    score: 93.617

     grace_period_enddate: 2013-03-02 05:01:01
1 row in set (0.01 sec)

mysql> update device set score=93.617 where _SK_=27 and cid="f58ff20c-7da5-4657-8ae7-49957c2204b0" and did="i:e2f433cd6259f738274b4d431843e0042741b484";
Query OK, 0 rows affected (0.01 sec)
Rows matched: 0 Changed: 0 Warnings: 0

In this case, we found that it answered 0 row matched, which is a difference from Standard MySQL.

Since some MySQL libraries would take the response to handle the error, this behavior would cause them to raise an exception because what they expected is "1 row matched".

We would be grateful if there's a way to fix this issue, or a workaround solution.

Thank for your assistance.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers