-
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
Different partition locations for the same key when SQL mode is differnt #54271
Comments
The root cause of the issue seems a little complex. First of all, the expressions in the partition table will be parsed as an tidb/pkg/table/tables/partition.go Line 115 in be334af
tidb/pkg/table/tables/partition.go Lines 241 to 245 in be334af
In this case, the upper bound of partition tidb/pkg/expression/constant_fold.go Lines 232 to 246 in be334af
After the expression finished building, we started to insert
When the compare returns NULL, it will be recognized as tidb/pkg/table/tables/partition.go Lines 1362 to 1366 in 761b592
That makes the same row located to the different partitions. |
I found this bug when I surveyed the test failure for PR #54101. The quick fix for this issue is to allow invalid dates in context to make the fold operation pass. But I'm not sure whether we have a better way to fix it... |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
The second insert should report an error because a is an primary key.
3. What did you see instead (Required)
The second insert succeeds. And we can see both of them can be found:
The located in different partitions
4. What is your TiDB version? (Required)
Master. But release version may also have this issue.
The text was updated successfully, but these errors were encountered: