fix: close issue 59446 make oct("") same as mysql (#61767)
close pingcap/tidb#59446
This commit is contained in:
@ -2993,6 +2993,11 @@ func (b *builtinOctStringSig) evalString(ctx EvalContext, row chunk.Row) (string
|
||||
return "", isNull, err
|
||||
}
|
||||
|
||||
// for issue #59446 should return NULL for empty string
|
||||
if len(val) == 0 {
|
||||
return "", true, nil
|
||||
}
|
||||
|
||||
negative, overflow := false, false
|
||||
val = getValidPrefix(strings.TrimSpace(val), 10)
|
||||
if len(val) == 0 {
|
||||
|
||||
@ -1774,8 +1774,15 @@ func (b *builtinOctStringSig) vecEvalString(ctx EvalContext, input *chunk.Chunk,
|
||||
result.AppendNull()
|
||||
continue
|
||||
}
|
||||
negative, overflow := false, false
|
||||
|
||||
// for issue #59446 should return NULL for empty string
|
||||
str := buf.GetString(i)
|
||||
if len(str) == 0 {
|
||||
result.AppendNull()
|
||||
continue
|
||||
}
|
||||
|
||||
negative, overflow := false, false
|
||||
str = getValidPrefix(strings.TrimSpace(str), 10)
|
||||
if len(str) == 0 {
|
||||
result.AppendString("0")
|
||||
|
||||
Reference in New Issue
Block a user