diff --git a/expression/scalar_function.go b/expression/scalar_function.go index dcf08249089ea..bbc3086ed944f 100644 --- a/expression/scalar_function.go +++ b/expression/scalar_function.go @@ -286,6 +286,7 @@ func (sf *ScalarFunction) Clone() Expression { } c.SetCharsetAndCollation(sf.CharsetAndCollation()) 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) }