executor: special handling is required when an "auto id out of range" error occurs in insert ignore into ... on on duplicate ...
(#39847)
#40286
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is an automated cherry-pick of #39847
What problem does this PR solve?
Issue Number: close #38950
Problem Summary:
What is changed and how it works?
The code below is added by PR #30301 to fix Issue #29483. When
replace
encounters a duplicatePRIMARY KEY
orUNIQUE KEY
, it is expected to have the semantics ofDELETE
+INSERT
, when Auto ID is out of range, the truncated ID is possible to duplicate with an existing ID, this leads to data corruption as unrelated rows are modified and removed.So when the
ignore
keyword exists in the SQL (orSET sql_mode='NO_ENGINE_SUBSTITUTION';
), if the Auto ID is out of range, the above code preventsreplace into
before it is actually executed, but it also prevents a lot SQLs that need to be executed, so special handling is required when anauto id out of range
error occurs ininsert ignore into ... on duplicate ...
to allow SQL to be executed successfully.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.