-
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
DDL: fix a bug in column charset and collate when create table and modify column (#11300) #11424
Conversation
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
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
/run-all-tests |
@AilinKid merge failed. |
/run-all-tests |
} | ||
if len(tp.Charset) == 0 { | ||
tp.Charset = derivedCollation.CharsetName | ||
} else if tp.Charset != derivedCollation.CharsetName { |
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.
Is it dead code in this else if
clause? The condition len(tp.Charset)
in line 319 is always to be true, because line 301 checks the same thing.
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.
Is it dead code in this
else if
clause? The conditionlen(tp.Charset)
in line 319 is always to be true, because line 301 checks the same thing.
The condition len(tp.Charset)
in line 319 not always to be true. For the first time, it is. After we assigned charset to it, it should be judged in following loop.
op := def.Options[i] | ||
if op.Tp == ast.ColumnOptionCollate { | ||
specifiedCollates = append(specifiedCollates, op.StrValue) | ||
def.Options = append(def.Options[:i], def.Options[i+1:]...) |
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.
What will happen if we don't delete the ColumnOptionCollate
option in ColumnDef?
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.
What will happen if we don't delete the
ColumnOptionCollate
option in ColumnDef?
Here if we don't remove it in Option
, it is ok for the subsequent logic, not a big deal.
But for ast.Restore
func, it will cause duplicate collate in restored SQL string.
03a88a3
to
8373888
Compare
/run-all-tests |
/run-all-tests |
/rebuild |
What problem does this PR solve?
cherry-pick to release 3.0 #11300
Check List
Tests