Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pkg/expression/builtin_math.go
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,11 @@ func (b *builtinConvSig) evalString(ctx EvalContext, row chunk.Row) (res string,
switch x := b.args[0].(type) {
case *Constant:
if x.Value.Kind() == types.KindBinaryLiteral {
str = x.Value.GetBinaryLiteral().ToBitLiteralString(true)
datum, err := x.Eval(ctx, row)
if err != nil {
return "", false, err
}
str = datum.GetBinaryLiteral().ToBitLiteralString(true)
}
case *ScalarFunction:
if x.FuncName.L == ast.Cast {
Expand Down
14 changes: 14 additions & 0 deletions pkg/planner/core/plan_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,20 @@ func TestPlanCacheBindingIgnore(t *testing.T) {
tk.MustQuery(`select @@last_plan_from_cache`).Check(testkit.Rows("0"))
}

func TestIssue53505(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec(`create table t (v varchar(16))`)
tk.MustExec(`insert into t values ('156')`)
tk.MustExec(`prepare stmt7 from 'select * from t where v = conv(?, 16, 8)'`)
tk.MustExec(`set @arg=0x6E`)
tk.MustQuery(`execute stmt7 using @arg`).Check(testkit.Rows("156"))
tk.MustQuery(`execute stmt7 using @arg`).Check(testkit.Rows("156"))
tk.MustExec(`set @arg=0x70`)
tk.MustQuery(`execute stmt7 using @arg`).Check(testkit.Rows()) // empty
}

func TestBuiltinFuncFlen(t *testing.T) {
// same as TestIssue45378 and TestIssue45253
store := testkit.CreateMockStore(t)
Expand Down