/ Check-in [c6cc2390]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid assuming that an expression that contains the sub-expression (? IS FALSE) or (? IS TRUE) may only be true if ? is non-null. Fix for [a976c487].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.30
Files: files | file ages | folders
SHA3-256: c6cc2390e91097a32992d11c74af8e77a6a42862ec8a936b549e156250629407
User & Date: drh 2019-10-10 16:21:57
Context
2019-10-10
20:19
Version 3.30.1 Leaf check-in: 18db032d user: drh tags: release, branch-3.30, version-3.30.1
16:21
Avoid assuming that an expression that contains the sub-expression (? IS FALSE) or (? IS TRUE) may only be true if ? is non-null. Fix for [a976c487]. check-in: c6cc2390 user: drh tags: branch-3.30
16:10
Fix a problem with running ALTER TABLE ADD COLUMN statements within a transaction that writes to one or more virtual tables. Fix for [8fe768e9]. check-in: a4974a0f user: drh tags: branch-3.30
2019-10-09
21:14
Avoid assuming that an expression that contains the sub-expression (? IS FALSE) or (? IS TRUE) may only be true if ? is non-null. Fix for [a976c487]. check-in: eb7ed90b user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/expr.c.

5142
5143
5144
5145
5146
5147
5148

5149
5150
5151
5152
5153
5154
5155
5156

5157
5158
5159
5160
5161
5162
5163
    case TK_ISNULL:
    case TK_NOTNULL:
    case TK_IS:
    case TK_OR:
    case TK_CASE:
    case TK_IN:
    case TK_FUNCTION:

      testcase( pExpr->op==TK_ISNOT );
      testcase( pExpr->op==TK_ISNULL );
      testcase( pExpr->op==TK_NOTNULL );
      testcase( pExpr->op==TK_IS );
      testcase( pExpr->op==TK_OR );
      testcase( pExpr->op==TK_CASE );
      testcase( pExpr->op==TK_IN );
      testcase( pExpr->op==TK_FUNCTION );

      return WRC_Prune;
    case TK_COLUMN:
      if( pWalker->u.iCur==pExpr->iTable ){
        pWalker->eCode = 1;
        return WRC_Abort;
      }
      return WRC_Prune;







>








>







5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
    case TK_ISNULL:
    case TK_NOTNULL:
    case TK_IS:
    case TK_OR:
    case TK_CASE:
    case TK_IN:
    case TK_FUNCTION:
    case TK_TRUTH:
      testcase( pExpr->op==TK_ISNOT );
      testcase( pExpr->op==TK_ISNULL );
      testcase( pExpr->op==TK_NOTNULL );
      testcase( pExpr->op==TK_IS );
      testcase( pExpr->op==TK_OR );
      testcase( pExpr->op==TK_CASE );
      testcase( pExpr->op==TK_IN );
      testcase( pExpr->op==TK_FUNCTION );
      testcase( pExpr->op==TK_TRUTH );
      return WRC_Prune;
    case TK_COLUMN:
      if( pWalker->u.iCur==pExpr->iTable ){
        pWalker->eCode = 1;
        return WRC_Abort;
      }
      return WRC_Prune;

Changes to test/join.test.

879
880
881
882
883
884
885
886





















887

  INSERT INTO t1(x) VALUES(0),(1);
  SELECT * FROM t1 LEFT JOIN (SELECT abs(1) AS y FROM t1) ON x WHERE NOT(y='a');
} {1 1 1 1}
do_execsql_test join-17.110 {
  SELECT * FROM t1 LEFT JOIN (SELECT abs(1)+2 AS y FROM t1) ON x
   WHERE NOT(y='a');
} {1 3 1 3}






















finish_test









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
  INSERT INTO t1(x) VALUES(0),(1);
  SELECT * FROM t1 LEFT JOIN (SELECT abs(1) AS y FROM t1) ON x WHERE NOT(y='a');
} {1 1 1 1}
do_execsql_test join-17.110 {
  SELECT * FROM t1 LEFT JOIN (SELECT abs(1)+2 AS y FROM t1) ON x
   WHERE NOT(y='a');
} {1 3 1 3}

#-------------------------------------------------------------------------
reset_db
do_execsql_test join-18.1 {
  CREATE TABLE t0(a);
  CREATE TABLE t1(b);
  CREATE VIEW v0 AS SELECT a FROM t1 LEFT JOIN t0;
  INSERT INTO t1 VALUES (1);
} {}

do_execsql_test join-18.2 {
  SELECT * FROM v0 WHERE NOT(v0.a IS FALSE);
} {{}}

do_execsql_test join-18.3 {
  SELECT * FROM t1 LEFT JOIN t0 WHERE NOT(a IS FALSE);
} {1 {}}

do_execsql_test join-18.4 {
  SELECT NOT(v0.a IS FALSE) FROM v0
} {1}

finish_test