#32540 Throw error when updating stock when auto increment is exceed…#3309
Open
vovsky wants to merge 1 commit intomagento:developfrom
Conversation
…d in inventory_source_item
Contributor
Author
|
@magento run all tests |
|
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description (*)
In \Magento\Inventory\Model\ResourceModel\SourceItem\SaveMultiple the "INSERT ... ON DUPLICATE KEY UPDATE" statement is used to save records in inventory_source_item table. Since inventory_source_item table has more than one unique/primary key this statement is unsafe (see https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html at the bottom). In this particular case when the auto increment value is reached and new record is being inserted it will update the last record in the table instead of creating new one, no errors is thrown.
Fixed Issues (if relevant)
Manual testing scenarios (*)
inventory_source_itemtable with max source_item_id 4294967295, e. g:INSERT INTOinventory_source_item(source_item_id,source_code,sku,quantity,status) VALUES (4294967295, 'default', 'test', '100.0000', '1');Expected result: error is thrown.
Actual Result: no error is thrown, stock item is not saved. The item with source_item_id 4294967295 is updated instead.
Questions or comments
Contribution checklist (*)