/ Check-in [4b646022]
Login

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

Overview
Comment:Get EXPLAIN QUERY PLAN working with the multi-index OR optimization. Added new test script "where9.test". (CVS 6084)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4b6460221011e02bedb724169e8e4793e539e65a
User & Date: drh 2008-12-30 16:18:48
Context
2008-12-30
16:35
Add LEFT JOIN test cases for multi-index OR in where9.test. (CVS 6085) check-in: 96f3b629 user: drh tags: trunk
16:18
Get EXPLAIN QUERY PLAN working with the multi-index OR optimization. Added new test script "where9.test". (CVS 6084) check-in: 4b646022 user: drh tags: trunk
16:13
Add further pseudo-randomly generated test cases to where8.test. (CVS 6083) check-in: e01f6ef9 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  This module is responsible for
    14     14   ** generating the code that loops through a table looking for applicable
    15     15   ** rows.  Indices are selected and used to speed the search when doing
    16     16   ** so is applicable.  Because this module is responsible for selecting
    17     17   ** indices, you might also think of this module as the "query optimizer".
    18     18   **
    19         -** $Id: where.c,v 1.353 2008/12/30 15:26:30 danielk1977 Exp $
           19  +** $Id: where.c,v 1.354 2008/12/30 16:18:48 drh Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   
    23     23   /*
    24     24   ** Trace output macros
    25     25   */
    26     26   #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
................................................................................
  3178   3178         zMsg = sqlite3MPrintf(db, "TABLE %s", pItem->zName);
  3179   3179         if( pItem->zAlias ){
  3180   3180           zMsg = sqlite3MAppendf(db, zMsg, "%s AS %s", zMsg, pItem->zAlias);
  3181   3181         }
  3182   3182         if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){
  3183   3183           zMsg = sqlite3MAppendf(db, zMsg, "%s WITH INDEX %s",
  3184   3184              zMsg, pLevel->plan.u.pIdx->zName);
         3185  +      }else if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){
         3186  +        zMsg = sqlite3MAppendf(db, zMsg, "%s VIA MULTI-INDEX UNION", zMsg);
  3185   3187         }else if( pLevel->plan.wsFlags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){
  3186   3188           zMsg = sqlite3MAppendf(db, zMsg, "%s USING PRIMARY KEY", zMsg);
  3187   3189         }
  3188   3190   #ifndef SQLITE_OMIT_VIRTUALTABLE
  3189   3191         else if( (pLevel->plan.wsFlags & WHERE_VIRTUALTABLE)!=0 ){
  3190   3192           sqlite3_index_info *pVtabIdx = pLevel->plan.u.pVtabIdx;
  3191   3193           zMsg = sqlite3MAppendf(db, zMsg, "%s VIRTUAL TABLE INDEX %d:%s", zMsg,

Added test/where9.test.

            1  +# 2008 December 30
            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.  The
           12  +# focus of this file is testing the multi-index OR clause optimizer.
           13  +#
           14  +# $Id: where9.test,v 1.1 2008/12/30 16:18:48 drh Exp $
           15  +
           16  +set testdir [file dirname $argv0]
           17  +source $testdir/tester.tcl
           18  +
           19  +ifcapable !or_opt {
           20  +  finish_test
           21  +  return
           22  +}
           23  +
           24  +# Evaluate SQL.  Return the result set followed by the
           25  +# and the number of full-scan steps.
           26  +#
           27  +proc count_steps {sql} {
           28  +  set r [db eval $sql]
           29  +  lappend r scan [db status step] sort [db status sort]
           30  +}
           31  +
           32  +
           33  +# Construct test data.  
           34  +# 
           35  +do_test where9-1.1 {
           36  +  db eval {
           37  +    CREATE TABLE t1(a INTEGER PRIMARY KEY,b,c,d,e,f,g);
           38  +    INSERT INTO t1 VALUES(1,11,1001,1.001,100.1,'bcdefghij','yxwvuts');
           39  +    INSERT INTO t1 VALUES(2,22,1001,2.002,100.1,'cdefghijk','yxwvuts');
           40  +    INSERT INTO t1 VALUES(3,33,1001,3.003,100.1,'defghijkl','xwvutsr');
           41  +    INSERT INTO t1 VALUES(4,44,2002,4.004,200.2,'efghijklm','xwvutsr');
           42  +    INSERT INTO t1 VALUES(5,55,2002,5.005,200.2,'fghijklmn','xwvutsr');
           43  +    INSERT INTO t1 VALUES(6,66,2002,6.006,200.2,'ghijklmno','xwvutsr');
           44  +    INSERT INTO t1 VALUES(7,77,3003,7.007,300.3,'hijklmnop','xwvutsr');
           45  +    INSERT INTO t1 VALUES(8,88,3003,8.008,300.3,'ijklmnopq','wvutsrq');
           46  +    INSERT INTO t1 VALUES(9,99,3003,9.009,300.3,'jklmnopqr','wvutsrq');
           47  +    INSERT INTO t1 VALUES(10,110,4004,10.01,400.4,'klmnopqrs','wvutsrq');
           48  +    INSERT INTO t1 VALUES(11,121,4004,11.011,400.4,'lmnopqrst','wvutsrq');
           49  +    INSERT INTO t1 VALUES(12,132,4004,12.012,400.4,'mnopqrstu','wvutsrq');
           50  +    INSERT INTO t1 VALUES(13,143,5005,13.013,500.5,'nopqrstuv','vutsrqp');
           51  +    INSERT INTO t1 VALUES(14,154,5005,14.014,500.5,'opqrstuvw','vutsrqp');
           52  +    INSERT INTO t1 VALUES(15,165,5005,15.015,500.5,'pqrstuvwx','vutsrqp');
           53  +    INSERT INTO t1 VALUES(16,176,6006,16.016,600.6,'qrstuvwxy','vutsrqp');
           54  +    INSERT INTO t1 VALUES(17,187,6006,17.017,600.6,'rstuvwxyz','vutsrqp');
           55  +    INSERT INTO t1 VALUES(18,198,6006,18.018,600.6,'stuvwxyza','utsrqpo');
           56  +    INSERT INTO t1 VALUES(19,209,7007,19.019,700.7,'tuvwxyzab','utsrqpo');
           57  +    INSERT INTO t1 VALUES(20,220,7007,20.02,700.7,'uvwxyzabc','utsrqpo');
           58  +    INSERT INTO t1 VALUES(21,231,7007,21.021,700.7,'vwxyzabcd','utsrqpo');
           59  +    INSERT INTO t1 VALUES(22,242,8008,22.022,800.8,'wxyzabcde','utsrqpo');
           60  +    INSERT INTO t1 VALUES(23,253,8008,23.023,800.8,'xyzabcdef','tsrqpon');
           61  +    INSERT INTO t1 VALUES(24,264,8008,24.024,800.8,'yzabcdefg','tsrqpon');
           62  +    INSERT INTO t1 VALUES(25,275,9009,25.025,900.9,'zabcdefgh','tsrqpon');
           63  +    INSERT INTO t1 VALUES(26,286,9009,26.026,900.9,'abcdefghi','tsrqpon');
           64  +    INSERT INTO t1 VALUES(27,297,9009,27.027,900.9,'bcdefghij','tsrqpon');
           65  +    INSERT INTO t1 VALUES(28,308,10010,28.028,1001.0,'cdefghijk','srqponm');
           66  +    INSERT INTO t1 VALUES(29,319,10010,29.029,1001.0,'defghijkl','srqponm');
           67  +    INSERT INTO t1 VALUES(30,330,10010,30.03,1001.0,'efghijklm','srqponm');
           68  +    INSERT INTO t1 VALUES(31,341,11011,31.031,1101.1,'fghijklmn','srqponm');
           69  +    INSERT INTO t1 VALUES(32,352,11011,32.032,1101.1,'ghijklmno','srqponm');
           70  +    INSERT INTO t1 VALUES(33,363,11011,33.033,1101.1,'hijklmnop','rqponml');
           71  +    INSERT INTO t1 VALUES(34,374,12012,34.034,1201.2,'ijklmnopq','rqponml');
           72  +    INSERT INTO t1 VALUES(35,385,12012,35.035,1201.2,'jklmnopqr','rqponml');
           73  +    INSERT INTO t1 VALUES(36,396,12012,36.036,1201.2,'klmnopqrs','rqponml');
           74  +    INSERT INTO t1 VALUES(37,407,13013,37.037,1301.3,'lmnopqrst','rqponml');
           75  +    INSERT INTO t1 VALUES(38,418,13013,38.038,1301.3,'mnopqrstu','qponmlk');
           76  +    INSERT INTO t1 VALUES(39,429,13013,39.039,1301.3,'nopqrstuv','qponmlk');
           77  +    INSERT INTO t1 VALUES(40,440,14014,40.04,1401.4,'opqrstuvw','qponmlk');
           78  +    INSERT INTO t1 VALUES(41,451,14014,41.041,1401.4,'pqrstuvwx','qponmlk');
           79  +    INSERT INTO t1 VALUES(42,462,14014,42.042,1401.4,'qrstuvwxy','qponmlk');
           80  +    INSERT INTO t1 VALUES(43,473,15015,43.043,1501.5,'rstuvwxyz','ponmlkj');
           81  +    INSERT INTO t1 VALUES(44,484,15015,44.044,1501.5,'stuvwxyza','ponmlkj');
           82  +    INSERT INTO t1 VALUES(45,495,15015,45.045,1501.5,'tuvwxyzab','ponmlkj');
           83  +    INSERT INTO t1 VALUES(46,506,16016,46.046,1601.6,'uvwxyzabc','ponmlkj');
           84  +    INSERT INTO t1 VALUES(47,517,16016,47.047,1601.6,'vwxyzabcd','ponmlkj');
           85  +    INSERT INTO t1 VALUES(48,528,16016,48.048,1601.6,'wxyzabcde','onmlkji');
           86  +    INSERT INTO t1 VALUES(49,539,17017,49.049,1701.7,'xyzabcdef','onmlkji');
           87  +    INSERT INTO t1 VALUES(50,550,17017,50.05,1701.7,'yzabcdefg','onmlkji');
           88  +    INSERT INTO t1 VALUES(51,561,17017,51.051,1701.7,'zabcdefgh','onmlkji');
           89  +    INSERT INTO t1 VALUES(52,572,18018,52.052,1801.8,'abcdefghi','onmlkji');
           90  +    INSERT INTO t1 VALUES(53,583,18018,53.053,1801.8,'bcdefghij','nmlkjih');
           91  +    INSERT INTO t1 VALUES(54,594,18018,54.054,1801.8,'cdefghijk','nmlkjih');
           92  +    INSERT INTO t1 VALUES(55,605,19019,55.055,1901.9,'defghijkl','nmlkjih');
           93  +    INSERT INTO t1 VALUES(56,616,19019,56.056,1901.9,'efghijklm','nmlkjih');
           94  +    INSERT INTO t1 VALUES(57,627,19019,57.057,1901.9,'fghijklmn','nmlkjih');
           95  +    INSERT INTO t1 VALUES(58,638,20020,58.058,2002.0,'ghijklmno','mlkjihg');
           96  +    INSERT INTO t1 VALUES(59,649,20020,59.059,2002.0,'hijklmnop','mlkjihg');
           97  +    INSERT INTO t1 VALUES(60,660,20020,60.06,2002.0,'ijklmnopq','mlkjihg');
           98  +    INSERT INTO t1 VALUES(61,671,21021,61.061,2102.1,'jklmnopqr','mlkjihg');
           99  +    INSERT INTO t1 VALUES(62,682,21021,62.062,2102.1,'klmnopqrs','mlkjihg');
          100  +    INSERT INTO t1 VALUES(63,693,21021,63.063,2102.1,'lmnopqrst','lkjihgf');
          101  +    INSERT INTO t1 VALUES(64,704,22022,64.064,2202.2,'mnopqrstu','lkjihgf');
          102  +    INSERT INTO t1 VALUES(65,715,22022,65.065,2202.2,'nopqrstuv','lkjihgf');
          103  +    INSERT INTO t1 VALUES(66,726,22022,66.066,2202.2,'opqrstuvw','lkjihgf');
          104  +    INSERT INTO t1 VALUES(67,737,23023,67.067,2302.3,'pqrstuvwx','lkjihgf');
          105  +    INSERT INTO t1 VALUES(68,748,23023,68.068,2302.3,'qrstuvwxy','kjihgfe');
          106  +    INSERT INTO t1 VALUES(69,759,23023,69.069,2302.3,'rstuvwxyz','kjihgfe');
          107  +    INSERT INTO t1 VALUES(70,770,24024,70.07,2402.4,'stuvwxyza','kjihgfe');
          108  +    INSERT INTO t1 VALUES(71,781,24024,71.071,2402.4,'tuvwxyzab','kjihgfe');
          109  +    INSERT INTO t1 VALUES(72,792,24024,72.072,2402.4,'uvwxyzabc','kjihgfe');
          110  +    INSERT INTO t1 VALUES(73,803,25025,73.073,2502.5,'vwxyzabcd','jihgfed');
          111  +    INSERT INTO t1 VALUES(74,814,25025,74.074,2502.5,'wxyzabcde','jihgfed');
          112  +    INSERT INTO t1 VALUES(75,825,25025,75.075,2502.5,'xyzabcdef','jihgfed');
          113  +    INSERT INTO t1 VALUES(76,836,26026,76.076,2602.6,'yzabcdefg','jihgfed');
          114  +    INSERT INTO t1 VALUES(77,847,26026,77.077,2602.6,'zabcdefgh','jihgfed');
          115  +    INSERT INTO t1 VALUES(78,858,26026,78.078,2602.6,'abcdefghi','ihgfedc');
          116  +    INSERT INTO t1 VALUES(79,869,27027,79.079,2702.7,'bcdefghij','ihgfedc');
          117  +    INSERT INTO t1 VALUES(80,880,27027,80.08,2702.7,'cdefghijk','ihgfedc');
          118  +    INSERT INTO t1 VALUES(81,891,27027,81.081,2702.7,'defghijkl','ihgfedc');
          119  +    INSERT INTO t1 VALUES(82,902,28028,82.082,2802.8,'efghijklm','ihgfedc');
          120  +    INSERT INTO t1 VALUES(83,913,28028,83.083,2802.8,'fghijklmn','hgfedcb');
          121  +    INSERT INTO t1 VALUES(84,924,28028,84.084,2802.8,'ghijklmno','hgfedcb');
          122  +    INSERT INTO t1 VALUES(85,935,29029,85.085,2902.9,'hijklmnop','hgfedcb');
          123  +    INSERT INTO t1 VALUES(86,946,29029,86.086,2902.9,'ijklmnopq','hgfedcb');
          124  +    INSERT INTO t1 VALUES(87,957,29029,87.087,2902.9,'jklmnopqr','hgfedcb');
          125  +    INSERT INTO t1 VALUES(88,968,30030,88.088,3003.0,'klmnopqrs','gfedcba');
          126  +    INSERT INTO t1 VALUES(89,979,30030,89.089,3003.0,'lmnopqrst','gfedcba');
          127  +    INSERT INTO t1 VALUES(90,NULL,30030,90.09,3003.0,'mnopqrstu','gfedcba');
          128  +    INSERT INTO t1 VALUES(91,1001,NULL,91.091,3103.1,'nopqrstuv','gfedcba');
          129  +    INSERT INTO t1 VALUES(92,1012,31031,NULL,3103.1,'opqrstuvw','gfedcba');
          130  +    INSERT INTO t1 VALUES(93,1023,31031,93.093,NULL,'pqrstuvwx','fedcbaz');
          131  +    INSERT INTO t1 VALUES(94,1034,32032,94.094,3203.2,NULL,'fedcbaz');
          132  +    INSERT INTO t1 VALUES(95,1045,32032,95.095,3203.2,'rstuvwxyz',NULL);
          133  +    INSERT INTO t1 VALUES(96,NULL,NULL,96.096,3203.2,'stuvwxyza','fedcbaz');
          134  +    INSERT INTO t1 VALUES(97,1067,33033,NULL,NULL,'tuvwxyzab','fedcbaz');
          135  +    INSERT INTO t1 VALUES(98,1078,33033,98.098,3303.3,NULL,NULL);
          136  +    INSERT INTO t1 VALUES(99,NULL,NULL,NULL,NULL,NULL,NULL);
          137  +    CREATE INDEX t1b ON t1(b);
          138  +    CREATE INDEX t1c ON t1(c);
          139  +    CREATE INDEX t1d ON t1(d);
          140  +    CREATE INDEX t1e ON t1(e);
          141  +    CREATE INDEX t1f ON t1(f);
          142  +    CREATE INDEX t1g ON t1(g);
          143  +    CREATE TABLE t2(a INTEGER PRIMARY KEY,b,c,d,e,f,g);
          144  +    INSERT INTO t2 SELECT * FROM t1;
          145  +    CREATE INDEX t2b ON t2(b,c);
          146  +    CREATE INDEX t2c ON t2(c,e);
          147  +    CREATE INDEX t2d ON t2(d,g);
          148  +    CREATE INDEX t2e ON t2(e,f,g);
          149  +    CREATE INDEX t2f ON t2(f,b,d,c);
          150  +    CREATE INDEX t2g ON t2(g,f);
          151  +  }
          152  +} {}
          153  +
          154  +do_test where9-1.2.1 {
          155  +  count_steps {
          156  +    SELECT a FROM t1
          157  +     WHERE b IS NULL
          158  +        OR c IS NULL
          159  +        OR d IS NULL
          160  +    ORDER BY a
          161  +  }
          162  +} {90 91 92 96 97 99 scan 0 sort 0}
          163  +do_test where9-1.2.2 {
          164  +  count_steps {
          165  +    SELECT a FROM t1
          166  +     WHERE +b IS NULL
          167  +        OR c IS NULL
          168  +        OR d IS NULL
          169  +    ORDER BY a
          170  +  }
          171  +} {90 91 92 96 97 99 scan 98 sort 0}
          172  +do_test where9-1.2.3 {
          173  +  count_steps {
          174  +    SELECT a FROM t1
          175  +     WHERE b IS NULL
          176  +        OR +c IS NULL
          177  +        OR d IS NULL
          178  +    ORDER BY a
          179  +  }
          180  +} {90 91 92 96 97 99 scan 98 sort 0}
          181  +do_test where9-1.2.4 {
          182  +  count_steps {
          183  +    SELECT a FROM t1
          184  +     WHERE b IS NULL
          185  +        OR c IS NULL
          186  +        OR +d IS NULL
          187  +    ORDER BY a
          188  +  }
          189  +} {90 91 92 96 97 99 scan 98 sort 0}
          190  +do_test where9-1.3 {
          191  +  count_steps {
          192  +    SELECT a FROM t1
          193  +     WHERE (b IS NULL AND c NOT NULL AND d NOT NULL)
          194  +        OR (b NOT NULL AND c IS NULL AND d NOT NULL)
          195  +        OR (b NOT NULL AND c NOT NULL AND d IS NULL)
          196  +    ORDER BY a
          197  +  }
          198  +} {90 91 92 97 scan 0 sort 0}
          199  +do_test where9-1.4 {
          200  +  count_steps {
          201  +    SELECT a FROM t1
          202  +     WHERE (b>=950 AND b<=1010) OR (b IS NULL AND c NOT NULL)
          203  +    ORDER BY a
          204  +  }
          205  +} {87 88 89 90 91 scan 0 sort 0}
          206  +do_test where9-1.5 {
          207  +  count_steps {
          208  +    SELECT a FROM t1
          209  +     WHERE a=83
          210  +        OR b=913
          211  +        OR c=28028
          212  +        OR (d>=82 AND d<83)
          213  +        OR (e>2802 AND e<2803) 
          214  +        OR f='fghijklmn'
          215  +        OR g='hgfedcb'
          216  +    ORDER BY a
          217  +  }
          218  +} {5 31 57 82 83 84 85 86 87 scan 0 sort 0}
          219  +do_test where9-1.6 {
          220  +  count_steps {
          221  +    SELECT a FROM t1
          222  +     WHERE b=1012
          223  +        OR (d IS NULL AND e IS NOT NULL)
          224  +  }
          225  +} {92 scan 0 sort 0}
          226  +do_test where9-1.7 {
          227  +  count_steps {
          228  +    SELECT a FROM t1
          229  +     WHERE (b=1012 OR (d IS NULL AND e IS NOT NULL))
          230  +       AND f!=g
          231  +  }
          232  +} {92 scan 0 sort 0}
          233  +do_test where9-1.8 {
          234  +  count_steps {
          235  +    SELECT a FROM t1
          236  +     WHERE (b=1012 OR (d IS NULL AND e IS NOT NULL))
          237  +       AND f==g
          238  +  }
          239  +} {scan 0 sort 0}
          240  +
          241  +do_test where9-2.1 {
          242  +  count_steps {
          243  +    SELECT t2.a FROM t1, t2
          244  +     WHERE t1.a=80
          245  +       AND (t1.c=t2.c OR t1.d=t2.d)
          246  +    ORDER BY 1
          247  +  }
          248  +} {79 80 81 scan 0 sort 1}
          249  +do_test where9-2.2 {
          250  +  count_steps {
          251  +    SELECT t2.a FROM t1, t2
          252  +     WHERE t1.a=80
          253  +       AND ((t1.c=t2.c AND t1.d=t2.d) OR t1.f=t2.f)
          254  +    ORDER BY 1
          255  +  }
          256  +} {2 28 54 80 scan 0 sort 1}
          257  +do_test where9-2.3 {
          258  +  count_steps {
          259  +    SELECT coalesce(t2.a,9999)
          260  +      FROM t1 LEFT JOIN t2 ON (t1.c=t2.c AND t1.d=t2.d) OR t1.f=t2.f
          261  +     WHERE t1.a=80
          262  +    ORDER BY 1
          263  +  }
          264  +} {2 28 54 80 scan 0 sort 1}
          265  +do_test where9-2.4 {
          266  +  count_steps {
          267  +    SELECT coalesce(t2.a,9999)
          268  +      FROM t1 LEFT JOIN t2 ON (t1.c+1=t2.c AND t1.d=t2.d) OR (t1.f||'x')=t2.f
          269  +     WHERE t1.a=80
          270  +    ORDER BY 1
          271  +  }
          272  +} {9999 scan 0 sort 1}
          273  +
          274  +
          275  +ifcapable explain {
          276  +  do_test where9-3.1 {
          277  +    set r [db eval {
          278  +      EXPLAIN QUERY PLAN
          279  +      SELECT t2.a FROM t1, t2
          280  +       WHERE t1.a=80
          281  +         AND ((t1.c=t2.c AND t1.d=t2.d) OR t1.f=t2.f)
          282  +    }]
          283  +    set a [expr {[lsearch $r {TABLE t2 VIA MULTI-INDEX UNION}]>=0}]
          284  +    set b [expr {[lsearch $r {TABLE t2 WITH INDEX t2f}]>=0}]
          285  +    set c [expr {([lsearch $r {TABLE t2 WITH INDEX t2c}]>=0)+
          286  +                  [lsearch $r {TABLE t2 WITH INDEX t2d}]>=0}]
          287  +    concat $a $b $c
          288  +  } {1 1 1}
          289  +  do_test where9-3.2 {
          290  +    set r [db eval {
          291  +      EXPLAIN QUERY PLAN
          292  +      SELECT coalesce(t2.a,9999)
          293  +        FROM t1 LEFT JOIN t2 ON (t1.c+1=t2.c AND t1.d=t2.d) OR (t1.f||'x')=t2.f
          294  +       WHERE t1.a=80
          295  +    }]
          296  +    set a [expr {[lsearch $r {TABLE t2 VIA MULTI-INDEX UNION}]>=0}]
          297  +    set b [expr {[lsearch $r {TABLE t2 WITH INDEX t2f}]>=0}]
          298  +    set c [expr {([lsearch $r {TABLE t2 WITH INDEX t2c}]>=0)+
          299  +                  [lsearch $r {TABLE t2 WITH INDEX t2d}]>=0}]
          300  +    concat $a $b $c
          301  +  } {1 1 1}
          302  +} 
          303  +
          304  +finish_test