/ Check-in [6af219d1]
Login

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

Overview
Comment:Merge fixes from trunk with this branch.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | stat4-skipscan
Files: files | file ages | folders
SHA1: 6af219d1b83ec54b3fb4ad4e6216d9ad9ea0fc70
User & Date: dan 2014-06-28 14:25:32
Context
2014-06-28
14:28
Change the VDBE to export the sqlite3MemCompare() routine and thus free where.c from the dependency on vdbeInt.h. check-in: d186d1ac user: drh tags: stat4-skipscan
14:25
Merge fixes from trunk with this branch. check-in: 6af219d1 user: dan tags: stat4-skipscan
2014-06-27
20:14
Fix a couple of problems in estimating the number of rows visited by a range query that uses a skip-scan. check-in: 219736f5 user: dan tags: stat4-skipscan
2014-06-26
22:17
Add some more IN operator tests. check-in: fb32e374 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

    29     29   ** SELECT * FROM t1 WHERE a;
    30     30   ** SELECT a AS b FROM t1 WHERE b;
    31     31   ** SELECT * FROM t1 WHERE (select a from t1);
    32     32   */
    33     33   char sqlite3ExprAffinity(Expr *pExpr){
    34     34     int op;
    35     35     pExpr = sqlite3ExprSkipCollate(pExpr);
    36         -  if( pExpr->flags & EP_Generic ) return SQLITE_AFF_NONE;
           36  +  if( pExpr->flags & EP_Generic ) return 0;
    37     37     op = pExpr->op;
    38     38     if( op==TK_SELECT ){
    39     39       assert( pExpr->flags&EP_xIsSelect );
    40     40       return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);
    41     41     }
    42     42   #ifndef SQLITE_OMIT_CAST
    43     43     if( op==TK_CAST ){

Added test/tkt-9a8b09f8e6.test.

            1  +# 2014 June 26
            2  +#
            3  +# The author disclaims copyright to this source code.  In place of
            4  +# a legal notice, here is a blessing:
            5  +#
            6  +#    May you do good and not evil.
            7  +#    May you find forgiveness for yourself and forgive others.
            8  +#    May you share freely, never taking more than you give.
            9  +#
           10  +#***********************************************************************
           11  +# This file implements regression tests for SQLite library.
           12  +#
           13  +# This file implements tests to verify that ticket [9a8b09f8e6] has been
           14  +# fixed.
           15  +#
           16  +
           17  +set testdir [file dirname $argv0]
           18  +source $testdir/tester.tcl
           19  +set testprefix tkt-9a8b09f8e6
           20  +
           21  +do_test 1.1 {
           22  +  execsql {
           23  +    CREATE TABLE t1(x TEXT);
           24  +    INSERT INTO t1 VALUES('1');
           25  +  }
           26  +} {}
           27  +
           28  +do_test 1.2 {
           29  +  execsql {
           30  +    CREATE TABLE t2(x INTEGER);
           31  +    INSERT INTO t2 VALUES(1);
           32  +  }
           33  +} {}
           34  +
           35  +do_test 1.3 {
           36  +  execsql {
           37  +    CREATE TABLE t3(x REAL);
           38  +    INSERT INTO t3 VALUES(1.0);
           39  +  }
           40  +} {}
           41  +
           42  +do_test 1.4 {
           43  +  execsql {
           44  +    CREATE TABLE t4(x REAL);
           45  +    INSERT INTO t4 VALUES(1.11);
           46  +  }
           47  +} {}
           48  +
           49  +do_test 1.5 {
           50  +  execsql {
           51  +    CREATE TABLE t5(x, y);
           52  +    INSERT INTO t5 VALUES('1', 'one');
           53  +    INSERT INTO t5 VALUES(1, 'two');
           54  +    INSERT INTO t5 VALUES('1.0', 'three');
           55  +    INSERT INTO t5 VALUES(1.0, 'four');
           56  +  }
           57  +} {}
           58  +
           59  +do_test 2.1 {
           60  +  execsql {
           61  +    SELECT x FROM t1 WHERE x IN (1);
           62  +  }
           63  +} {1}
           64  +
           65  +do_test 2.2 {
           66  +  execsql {
           67  +    SELECT x FROM t1 WHERE x IN (1.0);
           68  +  }
           69  +} {}
           70  +
           71  +do_test 2.3 {
           72  +  execsql {
           73  +    SELECT x FROM t1 WHERE x IN ('1');
           74  +  }
           75  +} {1}
           76  +
           77  +do_test 2.4 {
           78  +  execsql {
           79  +    SELECT x FROM t1 WHERE x IN ('1.0');
           80  +  }
           81  +} {}
           82  +
           83  +do_test 2.5 {
           84  +  execsql {
           85  +    SELECT x FROM t1 WHERE 1 IN (x);
           86  +  }
           87  +} {}
           88  +
           89  +do_test 2.6 {
           90  +  execsql {
           91  +    SELECT x FROM t1 WHERE 1.0 IN (x);
           92  +  }
           93  +} {}
           94  +
           95  +do_test 2.7 {
           96  +  execsql {
           97  +    SELECT x FROM t1 WHERE '1' IN (x);
           98  +  }
           99  +} {1}
          100  +
          101  +do_test 2.8 {
          102  +  execsql {
          103  +    SELECT x FROM t1 WHERE '1.0' IN (x);
          104  +  }
          105  +} {}
          106  +
          107  +do_test 3.1 {
          108  +  execsql {
          109  +    SELECT x FROM t2 WHERE x IN (1);
          110  +  }
          111  +} {1}
          112  +
          113  +do_test 3.2 {
          114  +  execsql {
          115  +    SELECT x FROM t2 WHERE x IN (1.0);
          116  +  }
          117  +} {1}
          118  +
          119  +do_test 3.3 {
          120  +  execsql {
          121  +    SELECT x FROM t2 WHERE x IN ('1');
          122  +  }
          123  +} {1}
          124  +
          125  +do_test 3.4 {
          126  +  execsql {
          127  +    SELECT x FROM t2 WHERE x IN ('1.0');
          128  +  }
          129  +} {1}
          130  +
          131  +do_test 3.5 {
          132  +  execsql {
          133  +    SELECT x FROM t2 WHERE 1 IN (x);
          134  +  }
          135  +} {1}
          136  +
          137  +do_test 3.6 {
          138  +  execsql {
          139  +    SELECT x FROM t2 WHERE 1.0 IN (x);
          140  +  }
          141  +} {1}
          142  +
          143  +do_test 3.7 {
          144  +  execsql {
          145  +    SELECT x FROM t2 WHERE '1' IN (x);
          146  +  }
          147  +} {}
          148  +
          149  +do_test 3.8 {
          150  +  execsql {
          151  +    SELECT x FROM t2 WHERE '1.0' IN (x);
          152  +  }
          153  +} {}
          154  +
          155  +do_test 4.1 {
          156  +  execsql {
          157  +    SELECT x FROM t3 WHERE x IN (1);
          158  +  }
          159  +} {1.0}
          160  +
          161  +do_test 4.2 {
          162  +  execsql {
          163  +    SELECT x FROM t3 WHERE x IN (1.0);
          164  +  }
          165  +} {1.0}
          166  +
          167  +do_test 4.3 {
          168  +  execsql {
          169  +    SELECT x FROM t3 WHERE x IN ('1');
          170  +  }
          171  +} {1.0}
          172  +
          173  +do_test 4.4 {
          174  +  execsql {
          175  +    SELECT x FROM t3 WHERE x IN ('1.0');
          176  +  }
          177  +} {1.0}
          178  +
          179  +do_test 4.5 {
          180  +  execsql {
          181  +    SELECT x FROM t3 WHERE 1 IN (x);
          182  +  }
          183  +} {1.0}
          184  +
          185  +do_test 4.6 {
          186  +  execsql {
          187  +    SELECT x FROM t3 WHERE 1.0 IN (x);
          188  +  }
          189  +} {1.0}
          190  +
          191  +do_test 4.7 {
          192  +  execsql {
          193  +    SELECT x FROM t3 WHERE '1' IN (x);
          194  +  }
          195  +} {}
          196  +
          197  +do_test 4.8 {
          198  +  execsql {
          199  +    SELECT x FROM t3 WHERE '1.0' IN (x);
          200  +  }
          201  +} {}
          202  +
          203  +do_test 5.1 {
          204  +  execsql {
          205  +    SELECT x FROM t4 WHERE x IN (1);
          206  +  }
          207  +} {}
          208  +
          209  +do_test 5.2 {
          210  +  execsql {
          211  +    SELECT x FROM t4 WHERE x IN (1.0);
          212  +  }
          213  +} {}
          214  +
          215  +do_test 5.3 {
          216  +  execsql {
          217  +    SELECT x FROM t4 WHERE x IN ('1');
          218  +  }
          219  +} {}
          220  +
          221  +do_test 5.4 {
          222  +  execsql {
          223  +    SELECT x FROM t4 WHERE x IN ('1.0');
          224  +  }
          225  +} {}
          226  +
          227  +do_test 5.5 {
          228  +  execsql {
          229  +    SELECT x FROM t4 WHERE x IN (1.11);
          230  +  }
          231  +} {1.11}
          232  +
          233  +do_test 5.6 {
          234  +  execsql {
          235  +    SELECT x FROM t4 WHERE x IN ('1.11');
          236  +  }
          237  +} {1.11}
          238  +
          239  +do_test 5.7 {
          240  +  execsql {
          241  +    SELECT x FROM t4 WHERE 1 IN (x);
          242  +  }
          243  +} {}
          244  +
          245  +do_test 5.8 {
          246  +  execsql {
          247  +    SELECT x FROM t4 WHERE 1.0 IN (x);
          248  +  }
          249  +} {}
          250  +
          251  +do_test 5.9 {
          252  +  execsql {
          253  +    SELECT x FROM t4 WHERE '1' IN (x);
          254  +  }
          255  +} {}
          256  +
          257  +do_test 5.10 {
          258  +  execsql {
          259  +    SELECT x FROM t4 WHERE '1.0' IN (x);
          260  +  }
          261  +} {}
          262  +
          263  +do_test 5.11 {
          264  +  execsql {
          265  +    SELECT x FROM t4 WHERE 1.11 IN (x);
          266  +  }
          267  +} {1.11}
          268  +
          269  +do_test 5.12 {
          270  +  execsql {
          271  +    SELECT x FROM t4 WHERE '1.11' IN (x);
          272  +  }
          273  +} {}
          274  +
          275  +do_test 6.1 {
          276  +  execsql {
          277  +    SELECT x, y FROM t5 WHERE x IN (1);
          278  +  }
          279  +} {1 two 1.0 four}
          280  +
          281  +do_test 6.2 {
          282  +  execsql {
          283  +    SELECT x, y FROM t5 WHERE x IN (1.0);
          284  +  }
          285  +} {1 two 1.0 four}
          286  +
          287  +do_test 6.3 {
          288  +  execsql {
          289  +    SELECT x, y FROM t5 WHERE x IN ('1');
          290  +  }
          291  +} {1 one}
          292  +
          293  +do_test 6.4 {
          294  +  execsql {
          295  +    SELECT x, y FROM t5 WHERE x IN ('1.0');
          296  +  }
          297  +} {1.0 three}
          298  +
          299  +do_test 6.5 {
          300  +  execsql {
          301  +    SELECT x, y FROM t5 WHERE 1 IN (x);
          302  +  }
          303  +} {1 two 1.0 four}
          304  +
          305  +do_test 6.6 {
          306  +  execsql {
          307  +    SELECT x, y FROM t5 WHERE 1.0 IN (x);
          308  +  }
          309  +} {1 two 1.0 four}
          310  +
          311  +do_test 6.7 {
          312  +  execsql {
          313  +    SELECT x, y FROM t5 WHERE '1' IN (x);
          314  +  }
          315  +} {1 one}
          316  +
          317  +do_test 6.8 {
          318  +  execsql {
          319  +    SELECT x, y FROM t5 WHERE '1.0' IN (x);
          320  +  }
          321  +} {1.0 three}
          322  +
          323  +finish_test