Skip to content

Commit a641bb0

Browse files
author
James Cor
committed
more tests
1 parent 1f0225d commit a641bb0

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

enginetest/queries/script_queries.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7413,6 +7413,32 @@ CREATE TABLE tab3 (
74137413
},
74147414
},
74157415
},
7416+
{
7417+
Name: "hash in tuple picks correct type and skips mixed types",
7418+
Dialect: "mysql",
7419+
SetUpScript: []string{
7420+
"create table t (v varchar(10));",
7421+
"insert into t values ('abc'), ('def'), ('ghi');",
7422+
},
7423+
Assertions: []ScriptTestAssertion{
7424+
{
7425+
Query: "select * from t where (v in ('xyz')) order by v;",
7426+
Expected: []sql.Row{},
7427+
},
7428+
{
7429+
Query: "select * from t where (v in (0, 'xyz')) order by v;",
7430+
Expected: []sql.Row{
7431+
{"abc"},
7432+
{"def"},
7433+
{"ghi"},
7434+
},
7435+
},
7436+
{
7437+
Query: "select * from t where (v in (1, 'xyz')) order by v;",
7438+
Expected: []sql.Row{},
7439+
},
7440+
},
7441+
},
74167442
{
74177443
Name: "strings in tuple are properly hashed",
74187444
Dialect: "mysql",

sql/expression/in.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func (in *InTuple) Eval(ctx *sql.Context, row sql.Row) (interface{}, error) {
171171
cmpExpr := newComparison(lLit, NewLiteral(rVal, rType))
172172
res, cErr := cmpExpr.Compare(ctx, nil)
173173
if cErr != nil {
174-
return nil, cErr
174+
continue
175175
}
176176
if res == 0 {
177177
return true, nil

0 commit comments

Comments
 (0)