-
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
expression: incompatibility with MySQL for ADDTIME() #21401
Changes from 4 commits
7ddf0f6
b18de93
d8b7527
1687ff8
b5dcb1b
abf9588
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5559,7 +5559,15 @@ func (b *builtinAddStringAndStringSig) evalString(row chunk.Row) (result string, | |
if isNull || err != nil { | ||
return "", isNull, err | ||
} | ||
if !isDuration(arg1Str) { | ||
return "", true, nil | ||
} | ||
sc := b.ctx.GetSessionVars().StmtCtx | ||
arg1Time, _ := types.ParseDatetime(sc, arg1Str) | ||
hidehalo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if arg1Time.Month() > 0 { | ||
return "", true, err | ||
} | ||
|
||
arg1, err = types.ParseDuration(sc, arg1Str, getFsp4TimeAddSub(arg1Str)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. MySQL also doesn't throw a error/warning. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's make sense. Should we remove those two test cases(below)? Or we should throw a error/warning inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if err != nil { | ||
if terror.ErrorEqual(err, types.ErrTruncatedWrongVal) { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Here is the reason, if
arg1Str
is not a MySQLTime
, it just return without error.