-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
execution: fix different error code from MySQL when inserting incorrect bigint value #19854
execution: fix different error code from MySQL when inserting incorrect bigint value #19854
Conversation
…e same problem in aggfunc_test
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.
Please add a unit test for this change.
2e8351e
to
191a8b2
Compare
…m/TszKitLo40/tidb into incorrect-error-code-bigint-value
My commit failed to pass the tests. I have no idea how to know whether the error should be thrown between |
The failed test case says,
Could you help fix it? @TszKitLo40 |
I am not sure whether my implementation is correct. What do you think of my implementation? |
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.
Please resolve conflict.
…m/TszKitLo40/tidb into incorrect-error-code-bigint-value
I have resolved it. |
I found that the bug is that '2 ^ 31 - 1' would be truncated to 2. |
@@ -177,7 +177,7 @@ func CastValue(ctx sessionctx.Context, val types.Datum, col *model.ColumnInfo, r | |||
if err1 != nil { | |||
logutil.BgLogger().Warn("Datum ToString failed", zap.Stringer("Datum", val), zap.Error(err1)) | |||
} | |||
err = sc.HandleTruncate(types.ErrTruncatedWrongVal.GenWithStackByArgs(col.FieldType.CompactStr(), str)) | |||
err = sc.HandleTruncate(types.ErrTruncated.GenWithStackByArgs(col.FieldType.CompactStr(), str)) |
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.
Modifying the code here will cause upper-level misjudgment errors and cause other problems. We should find other ways to resolved this issue.
I'm going to close this PR since it hasn't been updated for a long time. feel free to reopen if you want to continue with it. thank you for your contribution. |
What problem does this PR solve?
Issue Number: close #17832
Problem Summary:
fix different error code from MySQL when inserting incorrect bigint value
What's Changed:
Return types.ErrTruncated when the data is truncated in the cast value function.
Check List
Tests
Release note