From 1a941c81f980364d451bca40a732030a388d180d Mon Sep 17 00:00:00 2001 From: xiongjiwei Date: Fri, 10 Dec 2021 14:21:57 +0800 Subject: [PATCH] cherry pick #30602 to release-5.3 Signed-off-by: ti-srebot --- expression/scalar_function.go | 1 + expression/scalar_function_test.go | 2 ++ 2 files changed, 3 insertions(+) diff --git a/expression/scalar_function.go b/expression/scalar_function.go index dd7805a6c282f..943eb4fc89cb8 100644 --- a/expression/scalar_function.go +++ b/expression/scalar_function.go @@ -288,6 +288,7 @@ func (sf *ScalarFunction) Clone() Expression { } c.SetCharsetAndCollation(sf.CharsetAndCollation(sf.GetCtx())) c.SetCoercibility(sf.Coercibility()) + c.SetRepertoire(sf.Repertoire()) return c } diff --git a/expression/scalar_function_test.go b/expression/scalar_function_test.go index 66e4222dbc310..827cc63af6060 100644 --- a/expression/scalar_function_test.go +++ b/expression/scalar_function_test.go @@ -50,6 +50,8 @@ func TestScalarFunction(t *testing.T) { require.True(t, ok) require.Equal(t, "values", newSf.FuncName.O) require.Equal(t, mysql.TypeLonglong, newSf.RetType.Tp) + require.Equal(t, sf.Coercibility(), newSf.Coercibility()) + require.Equal(t, sf.Repertoire(), newSf.Repertoire()) _, ok = newSf.Function.(*builtinValuesIntSig) require.True(t, ok) }