Bug #109891 | Contribution by Tencent: insert on duplicate key update would be abnormal | ||
---|---|---|---|
Submitted: | 2 Feb 2023 9:10 | Modified: | 3 Feb 2023 6:49 |
Reporter: | Quanan Han (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 8.0.30,8.0.31, 8.0.32, 5.7 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[2 Feb 2023 9:10]
Quanan Han
[2 Feb 2023 9:51]
MySQL Verification Team
Hello Quanan Han, Thank you for the report and feedback. regards, Umesh
[2 Feb 2023 14:10]
huahua xu
Hi Quanan Han, I don't agree with you. `insert into ta(c2,c3) values(10,10) on duplicate key update c2=10, c3=10;` is equivalent to `insert into ta(c1,c2,c3) values(4294967295,10,10) on duplicate key update c1 = 4294967295, c2=10, c3=10;`, which is reasonable to throw an duplicate key error.
[3 Feb 2023 6:49]
Quanan Han
Hi, huahua xu Because of the column c2 is unique key,this must be update; Also you can also execute this query when the autu_incmrent is not full。
[3 Feb 2023 7:55]
huahua xu
`insert into ... on duplicate key update` can only handle conflicts on one uniqueness constraint, but `insert into ta(c2,c3) values(10,10) on duplicate key update c2=10, c3=10;` produces two conflicts on primary key and unique key.