diff --git a/plan/plans/from.go b/plan/plans/from.go index c055972050..20ee2662d9 100644 --- a/plan/plans/from.go +++ b/plan/plans/from.go @@ -244,7 +244,9 @@ func (r *TableDefaultPlan) filterIsNull(ctx context.Context, x *expression.IsNul cn := cns[0] t := r.T col := column.FindCol(t.Cols(), cn) - + if col == nil { + return r, false, nil + } if col.IsPKHandleColumn(t.Meta()) { if x.Not { // PK handle column never be null. diff --git a/session_test.go b/session_test.go index fa890d09e6..e522ae6604 100644 --- a/session_test.go +++ b/session_test.go @@ -611,6 +611,8 @@ func (s *testSessionSuite) TestSelect(c *C) { row, err = r.FirstRow() c.Assert(err, IsNil) match(c, row, 3) + + mustExecSQL(c, se, `select * from t1, t2 where t1.c1 is null`) } func (s *testSessionSuite) TestSubQuery(c *C) {