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
12 changes: 12 additions & 0 deletions expression/integration_test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8087,3 +8087,15 @@ func TestCastAsStringExplicitCharSet(t *testing.T) {
tk.MustExec("insert into test values(1,'张三'), (2,'李四'), (3,'张三'), (4,'李四')")
tk.MustQuery("select id from test order by cast(update_user as char) desc , id limit 3").Check(testkit.Rows("2", "4", "1"))
}

func TestIssue53580(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)

tk.MustExec("use test")
tk.MustExec("create table t (col TEXT);")
tk.MustQuery(`select 1 from (select t.col as c0, 46578369 as c1 from t) as t where
case when (
t.c0 in (t.c0, cast((cast(1 as unsigned) - cast(t.c1 as signed)) as char))
) then 1 else 2 end;`).Check(testkit.Rows())
}
6 changes: 5 additions & 1 deletion expression/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,11 @@ func ColumnSubstituteImpl(expr Expression, schema *Schema, newExprs []Expression
}
}
if substituted {
return true, hasFail, NewFunctionInternal(v.GetCtx(), v.FuncName.L, v.RetType, refExprArr.Result()...)
newFunc, err := NewFunction(v.GetCtx(), v.FuncName.L, v.RetType, refExprArr.Result()...)
if err != nil {
return true, true, v
}
return true, hasFail, newFunc
}
}
return false, false, expr
Expand Down
27 changes: 0 additions & 27 deletions tests/integrationtest/r/ddl/db_rename.result

This file was deleted.

27 changes: 0 additions & 27 deletions tests/integrationtest/t/ddl/db_rename.test

This file was deleted.