/ Check-in [5259d484]
Login

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

Overview
Comment:New test case for ticket [ec32177c99ccac2b1] that works without the STAT4.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5259d4847f2b73f26b2385f9d8cff8fe0cabc54b4deab8477c87c8d1bb5535b1
User & Date: drh 2018-01-27 13:55:56
Context
2018-01-27
14:25
Changes to avoid a harmless UB warning from clang. check-in: 19f5c140 user: drh tags: trunk
13:55
New test case for ticket [ec32177c99ccac2b1] that works without the STAT4. check-in: 5259d484 user: drh tags: trunk
05:40
Proposed fix for the query planner problem of ticket [ec32177c99ccac2b1]. check-in: eef8cbef user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/whereF.test.

   276    276        WHERE ( t1.b IS NOT NULL AND t2.bb IS NULL )
   277    277           OR ( t2.bb < t1.b )
   278    278           OR ( t1.b IS t2.bb AND t2.aa > t1.a )
   279    279       )
   280    280       FROM t1;
   281    281   } {2}
   282    282   
          283  +# The fix for ticket ec32177c99ccac2b180fd3ea2083 only makes a difference
          284  +# in the output when there is a TERM_VNULL entry in the WhereClause array.
          285  +# And TERM_VNULL entries are only generated when compiling with 
          286  +# SQLITE_ENABLE_STAT4.  Nevertheless, it is correct that TERM_VIRTUAL terms
          287  +# should not participate in the factoring optimization.  In all cases other
          288  +# than TERM_VNULL, participation is harmless, but it does consume a few
          289  +# extra CPU cycles.
          290  +#
          291  +# The following test verifies that the TERM_VIRTUAL terms resulting from
          292  +# a GLOB operator do not appear anywhere in the generated code.  This
          293  +# confirms that the problem is fixed, even on builds that omit STAT4.
          294  +#
          295  +do_execsql_test 7.3 {
          296  +  DROP TABLE IF EXISTS t1;
          297  +  DROP TABLE IF EXISTS t2;
          298  +  CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT);
          299  +  INSERT INTO t1(a,b) VALUES(1,'abcxyz');
          300  +  CREATE TABLE t2(aa INTEGER PRIMARY KEY, bb TEXT);
          301  +  INSERT INTO t2(aa,bb) VALUES(1,'abc'),(2,'wxyz'),(3,'xyz');
          302  +  CREATE INDEX t2bb ON t2(bb);
          303  +  EXPLAIN SELECT (
          304  +    SELECT COUNT(*) FROM t2
          305  +     WHERE ( t1.b GLOB 'a*z' AND t2.bb='xyz' )
          306  +        OR ( t2.bb = t1.b )
          307  +        OR ( t2.aa = t1.a )
          308  +    )
          309  +    FROM t1;
          310  +} {~/ (Lt|Ge) /}
   283    311   
   284    312   finish_test