-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.This bug affects the 8.5.x(LTS) versions.severity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
func TestBatchGetType(t *testing.T) {
ts := servertestkit.CreateTidbTestSuite(t)
ts.RunTests(t, nil, func(dbt *testkit.DBTestKit) {
dbt.MustExec("use test;")
dbt.MustExec("create table t (id1 varchar(255) collate utf8mb4_general_ci, id2 varchar(255) collate utf8mb4_general_ci, primary key (id1, id2));")
dbt.MustExec("insert into t values ('a', 'b'), ('c', 'd');")
conn, err := dbt.GetDB().Conn(context.Background())
require.NoError(t, err)
defer func() {
require.NoError(t, conn.Close())
}()
conn.ExecContext(context.Background(), "set @@session.collation_connection = 'utf8mb4_general_ci'")
stmt, err := conn.PrepareContext(context.Background(), "select * from t where (id1, id2) in ((?, ?), (?, ?))")
require.NoError(t, err)
rows, err := stmt.Query("A", "B", "C", "D");
require.NoError(t, err)
ts.CheckRows(t, rows, "a b\nc d")
})
}
It used BatchGet
. The parameter "?" has type "string collate utf8mb4_bin" (because TiDB doesn't set collation for parameter according to the connection collation. We should consider this issue later). Reference:
tidb/pkg/planner/core/point_get_plan.go
Line 1818 in 7424255
dVal, err := d.ConvertTo(evalCtx.TypeCtx(), &col.FieldType) |
2. What did you expect to see? (Required)
The test pass
3. What did you see instead (Required)
The test failed
4. What is your TiDB version? (Required)
Metadata
Metadata
Assignees
Labels
affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.This bug affects the 8.5.x(LTS) versions.severity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.