-
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
table partition: fix CREATE partitioned table fails check for unsigned int column definition #35876
Conversation
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
/run-unit-test |
/run-unit-test |
1 similar comment
/run-unit-test |
@@ -660,9 +660,11 @@ func buildRangePartitionDefinitions(ctx sessionctx.Context, defs []*ast.Partitio | |||
|
|||
func checkPartitionValuesIsInt(ctx sessionctx.Context, def *ast.PartitionDefinition, exprs []ast.ExprNode, tbInfo *model.TableInfo) error { | |||
tp := types.NewFieldType(mysql.TypeLonglong) | |||
if isColUnsigned(tbInfo.Columns, tbInfo.Partition) { |
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.
Since the function isColUnsigned is not working as expected, please remove it (or fix it).
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 address this.
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.
Currently, TiDB has a problem recognizing unsigned data type. If we change the condition substring to equal, for example, an expression like id-10
, id is unsigned data type, TiDB can't handle.
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.
Any suggestions on how to solve this? I still think we should not keep the broken isColUnsigned, we should either fix it or remove it ;)
In some edge cases it is OK to not be 100% compatible with MySQL if we have a good reason not to.
@mjonss If the contain is changed to equal, the case can't be handled, unit-test will fail, as shown below. |
So it will get another error? What would you suggest to handle this, accept the new error or fix the code to retain the old error? |
@mjonss |
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.
LGTM, just two minor things to address.
@@ -660,9 +660,11 @@ func buildRangePartitionDefinitions(ctx sessionctx.Context, defs []*ast.Partitio | |||
|
|||
func checkPartitionValuesIsInt(ctx sessionctx.Context, def *ast.PartitionDefinition, exprs []ast.ExprNode, tbInfo *model.TableInfo) error { | |||
tp := types.NewFieldType(mysql.TypeLonglong) | |||
if isColUnsigned(tbInfo.Columns, tbInfo.Partition) { |
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 address this.
@@ -822,6 +822,7 @@ const ( | |||
ErrMustChangePasswordLogin = 1862 | |||
ErrRowInWrongPartition = 1863 | |||
ErrErrorLast = 1863 | |||
ErrUnsignedNotLessThanZero = 1865 |
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.
ErrUnsignedNotLessThanZero = 1865 | |
ErrUnsignedLessThanZero = 1865 |
@@ -660,9 +660,11 @@ func buildRangePartitionDefinitions(ctx sessionctx.Context, defs []*ast.Partitio | |||
|
|||
func checkPartitionValuesIsInt(ctx sessionctx.Context, def *ast.PartitionDefinition, exprs []ast.ExprNode, tbInfo *model.TableInfo) error { | |||
tp := types.NewFieldType(mysql.TypeLonglong) | |||
if isColUnsigned(tbInfo.Columns, tbInfo.Partition) { |
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.
Any suggestions on how to solve this? I still think we should not keep the broken isColUnsigned, we should either fix it or remove it ;)
In some edge cases it is OK to not be 100% compatible with MySQL if we have a good reason not to.
Maybe something like this? |
What problem does this PR solve?
Issue Number: close #35827
Problem Summary:
What is changed and how it works?
Check List
Tests
Release note