-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
executer: fix the last_insert_id in insert on duplicate key update #7534
Conversation
/run-all-tests |
executor/write.go
Outdated
@@ -41,17 +41,15 @@ var ( | |||
// 1. changed (bool) : does the update really change the row values. e.g. update set i = 1 where i = 1; | |||
// 2. handleChanged (bool) : is the handle changed after the update. | |||
// 3. newHandle (int64) : if handleChanged == true, the newHandle means the new handle after update. | |||
// 4. lastInsertID (uint64) : the lastInsertID should be set by the newData. | |||
// 5. err (error) : error in the update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/5/4
/run-unit-test |
if err != nil { | ||
return 0, errors.Trace(err) | ||
} | ||
if e.lastInsertID != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the e.lastInsertID
is not set anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set it at line 449.
LGTM |
d3891d1
to
fc82385
Compare
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What problem does this PR solve?
The last insert ID should only be set when
insert into
an auto-increment column. The above SQL should obtainWhat is changed and how it works?
Set the last insert ID when
addRecord
in the insert statement.Check List
Tests
Code changes
Side effects
Related changes
PTAL @lysu @zimulala