diff --git a/util/ranger/detacher.go b/util/ranger/detacher.go index 65535f691f439..6d9b036f7200c 100644 --- a/util/ranger/detacher.go +++ b/util/ranger/detacher.go @@ -533,8 +533,7 @@ func ExtractEqAndInCondition(sctx sessionctx.Context, conditions []expression.Ex mergedAccesses[offset] = accesses[offset] points[offset] = rb.build(accesses[offset]) } - _, col := cond.CharsetAndCollation() - points[offset] = rb.intersection(points[offset], rb.build(cond), collate.GetCollator(col)) + points[offset] = rb.intersection(points[offset], rb.build(cond), collate.GetCollator(cols[offset].GetType().Collate)) if len(points[offset]) == 0 { // Early termination if false expression found if expression.MaybeOverOptimized4PlanCache(sctx, conditions) { // cannot return an empty-range for plan-cache since the range may become non-empty as parameters change