You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A similar issue from #2038, and use the test case from it. Please refer to the following screenshot.
So even if there are 12 rows which have "name == 5" in database (statement 1 in screenshot), but the transaction update RowsAffected is 0 (statement 2 in screenshot).
The SQL "UPDATE user_tests SET password = '12345' WHERE (name = '5')" works well in MySQL Console and "12 rows affected".
The document you expected this should be explained
Expected answer
It is a normal scenario or a bug?
Thank you.
The text was updated successfully, but these errors were encountered:
I think you might misunderstand the behavior of MySQL(or any other SQL servers).
By reading your codes and your console output of your snapshot, I think there is no bug in gorm, but misunderstanding on your side.
At first, you have 12 records that they are all the same, password is '12345', and name is '5'.
Then, you execute update query, set password to '12345' where name is '5', when executing, MySQL did found 12 rows with name '5', but it won't change anything as you are updating name to what it is now. so the result of mysql server returned should be Rows matched: 12 Changed: 0 Warnings: 0 (I don't think it works well in MySQL Console and "12 rows affected")
Last, you execute update query, set password to '44444' where name is '4', nothing matched, so nothing changed.
Everything works as expected on both MySQL server and gorm, you may need to check your mysql console as it works well in MySQL Console and "12 rows affected"
Your Question
Gorm: v1.25.5
Go: 1.21.4
MySQL: 8.0.31
A similar issue from #2038, and use the test case from it. Please refer to the following screenshot.
So even if there are 12 rows which have "name == 5" in database (statement 1 in screenshot), but the transaction update RowsAffected is 0 (statement 2 in screenshot).
The SQL "UPDATE
user_tests
SETpassword
= '12345' WHERE (name = '5')" works well in MySQL Console and "12 rows affected".The document you expected this should be explained
Expected answer
It is a normal scenario or a bug?
Thank you.
The text was updated successfully, but these errors were encountered: