/ Check-in [42505e5a]
Login

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

Overview
Comment:Test cases added for using unary "+" and CAST operators on the RHS of range constraints and verifying that STAT3/4 can use those constraints.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 42505e5a810832442699ca54a46637c50e7f9e71
User & Date: drh 2014-08-25 20:21:07
Context
2014-08-25
21:11
Minor changes to the CAST logic to make it more testable. check-in: 1ad70ec5 user: drh tags: trunk
20:21
Test cases added for using unary "+" and CAST operators on the RHS of range constraints and verifying that STAT3/4 can use those constraints. check-in: 42505e5a user: drh tags: trunk
20:11
Allow CAST expressions and unary "+" operators to be used in the DEFAULT argument of an ALTER TABLE ADD COLUMN and to be understand on the RHS of range constraints interpreted by STAT3/4. This involves a rewrite of the implementation of the CAST operator. check-in: 91d8a8d0 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Show Whitespace Changes Patch

Changes to test/analyzeA.test.

   113    113   foreach {tn analyze_cmd} {
   114    114     1 populate_stat4 
   115    115     2 populate_stat3
   116    116     3 populate_both
   117    117   } {
   118    118     reset_db
   119    119     do_test 1.$tn.1 {
   120         -    execsql { CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c) }
          120  +    execsql { CREATE TABLE t1(a INTEGER PRIMARY KEY, b INT, c INT) }
   121    121       for {set i 0} {$i < 100} {incr i} {
   122    122         set c [expr int(pow(1.1,$i)/100)]
   123    123         set b [expr 125 - int(pow(1.1,99-$i))/100]
   124    124         execsql {INSERT INTO t1 VALUES($i, $b, $c)}
   125    125       }
   126    126     } {}
   127    127   
................................................................................
   157    157     do_eqp_test 1.$tn.3.5 {
   158    158       SELECT * FROM t1 WHERE b BETWEEN 0 AND 50 AND c BETWEEN 0 AND 50
   159    159     } {0 0 0 {SEARCH TABLE t1 USING INDEX t1b (b>? AND b<?)}}
   160    160   
   161    161     do_eqp_test 1.$tn.3.6 {
   162    162       SELECT * FROM t1 WHERE b BETWEEN 75 AND 125 AND c BETWEEN 75 AND 125
   163    163     } {0 0 0 {SEARCH TABLE t1 USING INDEX t1c (c>? AND c<?)}}
          164  +
          165  +  do_eqp_test 1.$tn.3.7 {
          166  +    SELECT * FROM t1 WHERE b BETWEEN +0 AND +50 AND c BETWEEN +0 AND +50
          167  +  } {0 0 0 {SEARCH TABLE t1 USING INDEX t1b (b>? AND b<?)}}
          168  +
          169  +  do_eqp_test 1.$tn.3.8 {
          170  +    SELECT * FROM t1
          171  +     WHERE b BETWEEN cast('0' AS int) AND cast('50.0' AS real)
          172  +       AND c BETWEEN cast('0' AS numeric) AND cast('50.0' AS real)
          173  +  } {0 0 0 {SEARCH TABLE t1 USING INDEX t1b (b>? AND b<?)}}
          174  +
          175  +  do_eqp_test 1.$tn.3.9 {
          176  +    SELECT * FROM t1 WHERE b BETWEEN +75 AND +125 AND c BETWEEN +75 AND +125
          177  +  } {0 0 0 {SEARCH TABLE t1 USING INDEX t1c (c>? AND c<?)}}
          178  +
          179  +  do_eqp_test 1.$tn.3.10 {
          180  +    SELECT * FROM t1
          181  +     WHERE b BETWEEN cast('75' AS int) AND cast('125.0' AS real)
          182  +       AND c BETWEEN cast('75' AS numeric) AND cast('125.0' AS real)
          183  +  } {0 0 0 {SEARCH TABLE t1 USING INDEX t1c (c>? AND c<?)}}
   164    184   }
   165    185   
   166    186   finish_test
   167         -