fix: close issue 59446 make oct("") same as mysql (#61767)

close pingcap/tidb#59446
This commit is contained in:
yihong
2025-07-15 10:10:51 +08:00
committed by GitHub
parent adbdf3f0c7
commit 2f4f559b83
5 changed files with 36 additions and 4 deletions

View File

@ -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 {

View File

@ -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")