Home | History | Annotate | Download | only in test
      1 # 2005 September 19
      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 #1473 has been
     14 # fixed.  
     15 #
     16 
     17 set testdir [file dirname $argv0]
     18 source $testdir/tester.tcl
     19 
     20 ifcapable !compound {
     21   finish_test
     22   return 
     23 }
     24 
     25 do_test tkt1473-1.1 {
     26   execsql {
     27     CREATE TABLE t1(a,b);
     28     INSERT INTO t1 VALUES(1,2);
     29     INSERT INTO t1 VALUES(3,4);
     30     SELECT * FROM t1
     31   }
     32 } {1 2 3 4}
     33 
     34 do_test tkt1473-1.2 {
     35   execsql {
     36     SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=0
     37   }
     38 } {1}
     39 do_test tkt1473-1.3 {
     40   execsql {
     41     SELECT 1 FROM t1 WHERE a=1 UNION SELECT 2 FROM t1 WHERE b=0
     42   }
     43 } {1}
     44 do_test tkt1473-1.4 {
     45   execsql {
     46     SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=4
     47   }
     48 } {1 2}
     49 do_test tkt1473-1.5 {
     50   execsql {
     51     SELECT 1 FROM t1 WHERE a=1 UNION SELECT 2 FROM t1 WHERE b=4
     52   }
     53 } {1 2}
     54 do_test tkt1473-1.6 {
     55   execsql {
     56     SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=4
     57   }
     58 } {2}
     59 do_test tkt1473-1.7 {
     60   execsql {
     61     SELECT 1 FROM t1 WHERE a=0 UNION SELECT 2 FROM t1 WHERE b=4
     62   }
     63 } {2}
     64 do_test tkt1473-1.8 {
     65   execsql {
     66     SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=0
     67   }
     68 } {}
     69 do_test tkt1473-1.9 {
     70   execsql {
     71     SELECT 1 FROM t1 WHERE a=0 UNION SELECT 2 FROM t1 WHERE b=0
     72   }
     73 } {}
     74 
     75 # Everything from this point on depends on sub-queries. So skip it
     76 # if sub-queries are not available.
     77 ifcapable !subquery {
     78   finish_test
     79   return
     80 }
     81 
     82 do_test tkt1473-2.2 {
     83   execsql {
     84     SELECT (SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=0)
     85   }
     86 } {1}
     87 do_test tkt1473-2.3 {
     88   execsql {
     89     SELECT (SELECT 1 FROM t1 WHERE a=1 UNION SELECT 2 FROM t1 WHERE b=0)
     90   }
     91 } {1}
     92 do_test tkt1473-2.4 {
     93   execsql {
     94     SELECT (SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=4)
     95   }
     96 } {1}
     97 do_test tkt1473-2.5 {
     98   execsql {
     99     SELECT (SELECT 1 FROM t1 WHERE a=1 UNION SELECT 2 FROM t1 WHERE b=4)
    100   }
    101 } {1}
    102 do_test tkt1473-2.6 {
    103   execsql {
    104     SELECT (SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=4)
    105   }
    106 } {2}
    107 do_test tkt1473-2.7 {
    108   execsql {
    109     SELECT (SELECT 1 FROM t1 WHERE a=0 UNION SELECT 2 FROM t1 WHERE b=4)
    110   }
    111 } {2}
    112 do_test tkt1473-2.8 {
    113   execsql {
    114     SELECT (SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=0)
    115   }
    116 } {{}}
    117 do_test tkt1473-2.9 {
    118   execsql {
    119     SELECT (SELECT 1 FROM t1 WHERE a=0 UNION SELECT 2 FROM t1 WHERE b=0)
    120   }
    121 } {{}}
    122 
    123 do_test tkt1473-3.2 {
    124   execsql {
    125     SELECT EXISTS
    126       (SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=0)
    127   }
    128 } {1}
    129 do_test tkt1473-3.3 {
    130   execsql {
    131     SELECT EXISTS
    132       (SELECT 1 FROM t1 WHERE a=1 UNION SELECT 2 FROM t1 WHERE b=0)
    133   }
    134 } {1}
    135 do_test tkt1473-3.4 {
    136   execsql {
    137     SELECT EXISTS
    138       (SELECT 1 FROM t1 WHERE a=1 UNION ALL SELECT 2 FROM t1 WHERE b=4)
    139   }
    140 } {1}
    141 do_test tkt1473-3.5 {
    142   execsql {
    143     SELECT EXISTS
    144       (SELECT 1 FROM t1 WHERE a=1 UNION SELECT 2 FROM t1 WHERE b=4)
    145   }
    146 } {1}
    147 do_test tkt1473-3.6 {
    148   execsql {
    149     SELECT EXISTS
    150       (SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=4)
    151   }
    152 } {1}
    153 do_test tkt1473-3.7 {
    154   execsql {
    155     SELECT EXISTS
    156       (SELECT 1 FROM t1 WHERE a=0 UNION SELECT 2 FROM t1 WHERE b=4)
    157   }
    158 } {1}
    159 do_test tkt1473-3.8 {
    160   execsql {
    161     SELECT EXISTS
    162       (SELECT 1 FROM t1 WHERE a=0 UNION ALL SELECT 2 FROM t1 WHERE b=0)
    163   }
    164 } {0}
    165 do_test tkt1473-3.9 {
    166   execsql {
    167     SELECT EXISTS
    168       (SELECT 1 FROM t1 WHERE a=0 UNION SELECT 2 FROM t1 WHERE b=0)
    169   }
    170 } {0}
    171 
    172 do_test tkt1473-4.1 {
    173   execsql {
    174     CREATE TABLE t2(x,y);
    175     INSERT INTO t2 VALUES(1,2);
    176     INSERT INTO t2 SELECT x+2, y+2 FROM t2;
    177     INSERT INTO t2 SELECT x+4, y+4 FROM t2;
    178     INSERT INTO t2 SELECT x+8, y+8 FROM t2;
    179     INSERT INTO t2 SELECT x+16, y+16 FROM t2;
    180     INSERT INTO t2 SELECT x+32, y+32 FROM t2;
    181     INSERT INTO t2 SELECT x+64, y+64 FROM t2;
    182     SELECT count(*), sum(x), sum(y) FROM t2;
    183   }
    184 } {64 4096 4160}
    185 do_test tkt1473-4.2 {
    186   execsql {
    187     SELECT 1 FROM t2 WHERE x=0
    188     UNION ALL
    189     SELECT 2 FROM t2 WHERE x=1
    190     UNION ALL
    191     SELECT 3 FROM t2 WHERE x=2
    192     UNION ALL
    193     SELECT 4 FROM t2 WHERE x=3
    194     UNION ALL
    195     SELECT 5 FROM t2 WHERE x=4
    196     UNION ALL
    197     SELECT 6 FROM t2 WHERE y=0
    198     UNION ALL
    199     SELECT 7 FROM t2 WHERE y=1
    200     UNION ALL
    201     SELECT 8 FROM t2 WHERE y=2
    202     UNION ALL
    203     SELECT 9 FROM t2 WHERE y=3
    204     UNION ALL
    205     SELECT 10 FROM t2 WHERE y=4
    206   }
    207 } {2 4 8 10}
    208 do_test tkt1473-4.3 {
    209   execsql {
    210     SELECT (
    211       SELECT 1 FROM t2 WHERE x=0
    212       UNION ALL
    213       SELECT 2 FROM t2 WHERE x=1
    214       UNION ALL
    215       SELECT 3 FROM t2 WHERE x=2
    216       UNION ALL
    217       SELECT 4 FROM t2 WHERE x=3
    218       UNION ALL
    219       SELECT 5 FROM t2 WHERE x=4
    220       UNION ALL
    221       SELECT 6 FROM t2 WHERE y=0
    222       UNION ALL
    223       SELECT 7 FROM t2 WHERE y=1
    224       UNION ALL
    225       SELECT 8 FROM t2 WHERE y=2
    226       UNION ALL
    227       SELECT 9 FROM t2 WHERE y=3
    228       UNION ALL
    229       SELECT 10 FROM t2 WHERE y=4
    230     )
    231   }
    232 } {2}
    233 do_test tkt1473-4.4 {
    234   execsql {
    235     SELECT (
    236       SELECT 1 FROM t2 WHERE x=0
    237       UNION ALL
    238       SELECT 2 FROM t2 WHERE x=-1
    239       UNION ALL
    240       SELECT 3 FROM t2 WHERE x=2
    241       UNION ALL
    242       SELECT 4 FROM t2 WHERE x=3
    243       UNION ALL
    244       SELECT 5 FROM t2 WHERE x=4
    245       UNION ALL
    246       SELECT 6 FROM t2 WHERE y=0
    247       UNION ALL
    248       SELECT 7 FROM t2 WHERE y=1
    249       UNION ALL
    250       SELECT 8 FROM t2 WHERE y=2
    251       UNION ALL
    252       SELECT 9 FROM t2 WHERE y=3
    253       UNION ALL
    254       SELECT 10 FROM t2 WHERE y=4
    255     )
    256   }
    257 } {4}
    258 do_test tkt1473-4.5 {
    259   execsql {
    260     SELECT (
    261       SELECT 1 FROM t2 WHERE x=0
    262       UNION ALL
    263       SELECT 2 FROM t2 WHERE x=-1
    264       UNION ALL
    265       SELECT 3 FROM t2 WHERE x=2
    266       UNION ALL
    267       SELECT 4 FROM t2 WHERE x=-1
    268       UNION ALL
    269       SELECT 5 FROM t2 WHERE x=4
    270       UNION ALL
    271       SELECT 6 FROM t2 WHERE y=0
    272       UNION ALL
    273       SELECT 7 FROM t2 WHERE y=1
    274       UNION ALL
    275       SELECT 8 FROM t2 WHERE y=2
    276       UNION ALL
    277       SELECT 9 FROM t2 WHERE y=3
    278       UNION ALL
    279       SELECT 10 FROM t2 WHERE y=-4
    280     )
    281   }
    282 } {8}
    283 do_test tkt1473-4.6 {
    284   execsql {
    285     SELECT (
    286       SELECT 1 FROM t2 WHERE x=0
    287       UNION ALL
    288       SELECT 2 FROM t2 WHERE x=-1
    289       UNION ALL
    290       SELECT 3 FROM t2 WHERE x=2
    291       UNION ALL
    292       SELECT 4 FROM t2 WHERE x=-2
    293       UNION ALL
    294       SELECT 5 FROM t2 WHERE x=4
    295       UNION ALL
    296       SELECT 6 FROM t2 WHERE y=0
    297       UNION ALL
    298       SELECT 7 FROM t2 WHERE y=1
    299       UNION ALL
    300       SELECT 8 FROM t2 WHERE y=-3
    301       UNION ALL
    302       SELECT 9 FROM t2 WHERE y=3
    303       UNION ALL
    304       SELECT 10 FROM t2 WHERE y=4
    305     )
    306   }
    307 } {10}
    308 do_test tkt1473-4.7 {
    309   execsql {
    310     SELECT (
    311       SELECT 1 FROM t2 WHERE x=0
    312       UNION ALL
    313       SELECT 2 FROM t2 WHERE x=-1
    314       UNION ALL
    315       SELECT 3 FROM t2 WHERE x=2
    316       UNION ALL
    317       SELECT 4 FROM t2 WHERE x=-2
    318       UNION ALL
    319       SELECT 5 FROM t2 WHERE x=4
    320       UNION ALL
    321       SELECT 6 FROM t2 WHERE y=0
    322       UNION ALL
    323       SELECT 7 FROM t2 WHERE y=1
    324       UNION ALL
    325       SELECT 8 FROM t2 WHERE y=-3
    326       UNION ALL
    327       SELECT 9 FROM t2 WHERE y=3
    328       UNION ALL
    329       SELECT 10 FROM t2 WHERE y=-4
    330     )
    331   }
    332 } {{}}
    333 
    334 do_test tkt1473-5.3 {
    335   execsql {
    336     SELECT EXISTS (
    337       SELECT 1 FROM t2 WHERE x=0
    338       UNION ALL
    339       SELECT 2 FROM t2 WHERE x=1
    340       UNION ALL
    341       SELECT 3 FROM t2 WHERE x=2
    342       UNION ALL
    343       SELECT 4 FROM t2 WHERE x=3
    344       UNION ALL
    345       SELECT 5 FROM t2 WHERE x=4
    346       UNION ALL
    347       SELECT 6 FROM t2 WHERE y=0
    348       UNION ALL
    349       SELECT 7 FROM t2 WHERE y=1
    350       UNION ALL
    351       SELECT 8 FROM t2 WHERE y=2
    352       UNION ALL
    353       SELECT 9 FROM t2 WHERE y=3
    354       UNION ALL
    355       SELECT 10 FROM t2 WHERE y=4
    356     )
    357   }
    358 } {1}
    359 do_test tkt1473-5.4 {
    360   execsql {
    361     SELECT EXISTS (
    362       SELECT 1 FROM t2 WHERE x=0
    363       UNION ALL
    364       SELECT 2 FROM t2 WHERE x=-1
    365       UNION ALL
    366       SELECT 3 FROM t2 WHERE x=2
    367       UNION ALL
    368       SELECT 4 FROM t2 WHERE x=3
    369       UNION ALL
    370       SELECT 5 FROM t2 WHERE x=4
    371       UNION ALL
    372       SELECT 6 FROM t2 WHERE y=0
    373       UNION ALL
    374       SELECT 7 FROM t2 WHERE y=1
    375       UNION ALL
    376       SELECT 8 FROM t2 WHERE y=2
    377       UNION ALL
    378       SELECT 9 FROM t2 WHERE y=3
    379       UNION ALL
    380       SELECT 10 FROM t2 WHERE y=4
    381     )
    382   }
    383 } {1}
    384 
    385 do_test tkt1473-5.5 {
    386   execsql {
    387     SELECT EXISTS (
    388       SELECT 1 FROM t2 WHERE x=0
    389       UNION ALL
    390       SELECT 2 FROM t2 WHERE x=-1
    391       UNION ALL
    392       SELECT 3 FROM t2 WHERE x=2
    393       UNION ALL
    394       SELECT 4 FROM t2 WHERE x=-1
    395       UNION ALL
    396       SELECT 5 FROM t2 WHERE x=4
    397       UNION ALL
    398       SELECT 6 FROM t2 WHERE y=0
    399       UNION ALL
    400       SELECT 7 FROM t2 WHERE y=1
    401       UNION ALL
    402       SELECT 8 FROM t2 WHERE y=2
    403       UNION ALL
    404       SELECT 9 FROM t2 WHERE y=3
    405       UNION ALL
    406       SELECT 10 FROM t2 WHERE y=-4
    407     )
    408   }
    409 } {1}
    410 do_test tkt1473-5.6 {
    411   execsql {
    412     SELECT EXISTS (
    413       SELECT 1 FROM t2 WHERE x=0
    414       UNION ALL
    415       SELECT 2 FROM t2 WHERE x=-1
    416       UNION ALL
    417       SELECT 3 FROM t2 WHERE x=2
    418       UNION ALL
    419       SELECT 4 FROM t2 WHERE x=-2
    420       UNION ALL
    421       SELECT 5 FROM t2 WHERE x=4
    422       UNION ALL
    423       SELECT 6 FROM t2 WHERE y=0
    424       UNION ALL
    425       SELECT 7 FROM t2 WHERE y=1
    426       UNION ALL
    427       SELECT 8 FROM t2 WHERE y=-3
    428       UNION ALL
    429       SELECT 9 FROM t2 WHERE y=3
    430       UNION ALL
    431       SELECT 10 FROM t2 WHERE y=4
    432     )
    433   }
    434 } {1}
    435 do_test tkt1473-5.7 {
    436   execsql {
    437     SELECT EXISTS (
    438       SELECT 1 FROM t2 WHERE x=0
    439       UNION ALL
    440       SELECT 2 FROM t2 WHERE x=-1
    441       UNION ALL
    442       SELECT 3 FROM t2 WHERE x=2
    443       UNION ALL
    444       SELECT 4 FROM t2 WHERE x=-2
    445       UNION ALL
    446       SELECT 5 FROM t2 WHERE x=4
    447       UNION ALL
    448       SELECT 6 FROM t2 WHERE y=0
    449       UNION ALL
    450       SELECT 7 FROM t2 WHERE y=1
    451       UNION ALL
    452       SELECT 8 FROM t2 WHERE y=-3
    453       UNION ALL
    454       SELECT 9 FROM t2 WHERE y=3
    455       UNION ALL
    456       SELECT 10 FROM t2 WHERE y=-4
    457     )
    458   }
    459 } {0}
    460 
    461 do_test tkt1473-6.3 {
    462   execsql {
    463     SELECT EXISTS (
    464       SELECT 1 FROM t2 WHERE x=0
    465       UNION
    466       SELECT 2 FROM t2 WHERE x=1
    467       UNION
    468       SELECT 3 FROM t2 WHERE x=2
    469       UNION
    470       SELECT 4 FROM t2 WHERE x=3
    471       UNION
    472       SELECT 5 FROM t2 WHERE x=4
    473       UNION
    474       SELECT 6 FROM t2 WHERE y=0
    475       UNION
    476       SELECT 7 FROM t2 WHERE y=1
    477       UNION
    478       SELECT 8 FROM t2 WHERE y=2
    479       UNION
    480       SELECT 9 FROM t2 WHERE y=3
    481       UNION
    482       SELECT 10 FROM t2 WHERE y=4
    483     )
    484   }
    485 } {1}
    486 do_test tkt1473-6.4 {
    487   execsql {
    488     SELECT EXISTS (
    489       SELECT 1 FROM t2 WHERE x=0
    490       UNION
    491       SELECT 2 FROM t2 WHERE x=-1
    492       UNION
    493       SELECT 3 FROM t2 WHERE x=2
    494       UNION
    495       SELECT 4 FROM t2 WHERE x=3
    496       UNION
    497       SELECT 5 FROM t2 WHERE x=4
    498       UNION
    499       SELECT 6 FROM t2 WHERE y=0
    500       UNION
    501       SELECT 7 FROM t2 WHERE y=1
    502       UNION
    503       SELECT 8 FROM t2 WHERE y=2
    504       UNION
    505       SELECT 9 FROM t2 WHERE y=3
    506       UNION
    507       SELECT 10 FROM t2 WHERE y=4
    508     )
    509   }
    510 } {1}
    511 
    512 do_test tkt1473-6.5 {
    513   execsql {
    514     SELECT EXISTS (
    515       SELECT 1 FROM t2 WHERE x=0
    516       UNION
    517       SELECT 2 FROM t2 WHERE x=-1
    518       UNION
    519       SELECT 3 FROM t2 WHERE x=2
    520       UNION
    521       SELECT 4 FROM t2 WHERE x=-1
    522       UNION
    523       SELECT 5 FROM t2 WHERE x=4
    524       UNION
    525       SELECT 6 FROM t2 WHERE y=0
    526       UNION
    527       SELECT 7 FROM t2 WHERE y=1
    528       UNION
    529       SELECT 8 FROM t2 WHERE y=2
    530       UNION
    531       SELECT 9 FROM t2 WHERE y=3
    532       UNION
    533       SELECT 10 FROM t2 WHERE y=-4
    534     )
    535   }
    536 } {1}
    537 do_test tkt1473-6.6 {
    538   execsql {
    539     SELECT EXISTS (
    540       SELECT 1 FROM t2 WHERE x=0
    541       UNION
    542       SELECT 2 FROM t2 WHERE x=-1
    543       UNION
    544       SELECT 3 FROM t2 WHERE x=2
    545       UNION
    546       SELECT 4 FROM t2 WHERE x=-2
    547       UNION
    548       SELECT 5 FROM t2 WHERE x=4
    549       UNION
    550       SELECT 6 FROM t2 WHERE y=0
    551       UNION
    552       SELECT 7 FROM t2 WHERE y=1
    553       UNION
    554       SELECT 8 FROM t2 WHERE y=-3
    555       UNION
    556       SELECT 9 FROM t2 WHERE y=3
    557       UNION
    558       SELECT 10 FROM t2 WHERE y=4
    559     )
    560   }
    561 } {1}
    562 do_test tkt1473-6.7 {
    563   execsql {
    564     SELECT EXISTS (
    565       SELECT 1 FROM t2 WHERE x=0
    566       UNION
    567       SELECT 2 FROM t2 WHERE x=-1
    568       UNION
    569       SELECT 3 FROM t2 WHERE x=2
    570       UNION
    571       SELECT 4 FROM t2 WHERE x=-2
    572       UNION
    573       SELECT 5 FROM t2 WHERE x=4
    574       UNION
    575       SELECT 6 FROM t2 WHERE y=0
    576       UNION
    577       SELECT 7 FROM t2 WHERE y=1
    578       UNION
    579       SELECT 8 FROM t2 WHERE y=-3
    580       UNION
    581       SELECT 9 FROM t2 WHERE y=3
    582       UNION
    583       SELECT 10 FROM t2 WHERE y=-4
    584     )
    585   }
    586 } {0}
    587 do_test tkt1473-6.8 {
    588   execsql {
    589     SELECT EXISTS (
    590       SELECT 1 FROM t2 WHERE x=0
    591       UNION
    592       SELECT 2 FROM t2 WHERE x=-1
    593       UNION
    594       SELECT 3 FROM t2 WHERE x=2
    595       UNION
    596       SELECT 4 FROM t2 WHERE x=-2
    597       UNION
    598       SELECT 5 FROM t2 WHERE x=4
    599       UNION ALL
    600       SELECT 6 FROM t2 WHERE y=0
    601       UNION
    602       SELECT 7 FROM t2 WHERE y=1
    603       UNION
    604       SELECT 8 FROM t2 WHERE y=-3
    605       UNION
    606       SELECT 9 FROM t2 WHERE y=3
    607       UNION
    608       SELECT 10 FROM t2 WHERE y=4
    609     )
    610   }
    611 } {1}
    612 do_test tkt1473-6.9 {
    613   execsql {
    614     SELECT EXISTS (
    615       SELECT 1 FROM t2 WHERE x=0
    616       UNION
    617       SELECT 2 FROM t2 WHERE x=-1
    618       UNION
    619       SELECT 3 FROM t2 WHERE x=2
    620       UNION
    621       SELECT 4 FROM t2 WHERE x=-2
    622       UNION
    623       SELECT 5 FROM t2 WHERE x=4
    624       UNION ALL
    625       SELECT 6 FROM t2 WHERE y=0
    626       UNION
    627       SELECT 7 FROM t2 WHERE y=1
    628       UNION
    629       SELECT 8 FROM t2 WHERE y=-3
    630       UNION
    631       SELECT 9 FROM t2 WHERE y=3
    632       UNION
    633       SELECT 10 FROM t2 WHERE y=-4
    634     )
    635   }
    636 } {0}
    637 
    638 do_test tkt1473-7.1 {
    639   execsql {
    640     SELECT 1 FROM t2 WHERE x=1 EXCEPT SELECT 2 FROM t2 WHERE y=2
    641   }
    642 } {1}
    643 do_test tkt1473-7.2 {
    644   execsql {
    645     SELECT (
    646       SELECT 1 FROM t2 WHERE x=1 EXCEPT SELECT 2 FROM t2 WHERE y=2
    647     )
    648   }
    649 } {1}
    650 do_test tkt1473-7.3 {
    651   execsql {
    652     SELECT EXISTS (
    653       SELECT 1 FROM t2 WHERE x=1 EXCEPT SELECT 2 FROM t2 WHERE y=2
    654     )
    655   }
    656 } {1}
    657 do_test tkt1473-7.4 {
    658   execsql {
    659     SELECT (
    660       SELECT 1 FROM t2 WHERE x=0 EXCEPT SELECT 2 FROM t2 WHERE y=2
    661     )
    662   }
    663 } {{}}
    664 do_test tkt1473-7.5 {
    665   execsql {
    666     SELECT EXISTS (
    667       SELECT 1 FROM t2 WHERE x=0 EXCEPT SELECT 2 FROM t2 WHERE y=2
    668     )
    669   }
    670 } {0}
    671 
    672 do_test tkt1473-8.1 {
    673   execsql {
    674     SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 2 FROM t2 WHERE y=2
    675   }
    676 } {}
    677 do_test tkt1473-8.1 {
    678   execsql {
    679     SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 1 FROM t2 WHERE y=2
    680   }
    681 } {1}
    682 do_test tkt1473-8.3 {
    683   execsql {
    684     SELECT (
    685       SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 2 FROM t2 WHERE y=2
    686     )
    687   }
    688 } {{}}
    689 do_test tkt1473-8.4 {
    690   execsql {
    691     SELECT (
    692       SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 1 FROM t2 WHERE y=2
    693     )
    694   }
    695 } {1}
    696 do_test tkt1473-8.5 {
    697   execsql {
    698     SELECT EXISTS (
    699       SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 2 FROM t2 WHERE y=2
    700     )
    701   }
    702 } {0}
    703 do_test tkt1473-8.6 {
    704   execsql {
    705     SELECT EXISTS (
    706       SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 1 FROM t2 WHERE y=2
    707     )
    708   }
    709 } {1}
    710 do_test tkt1473-8.7 {
    711   execsql {
    712     SELECT (
    713       SELECT 1 FROM t2 WHERE x=0 INTERSECT SELECT 1 FROM t2 WHERE y=2
    714     )
    715   }
    716 } {{}}
    717 do_test tkt1473-8.8 {
    718   execsql {
    719     SELECT EXISTS (
    720       SELECT 1 FROM t2 WHERE x=1 INTERSECT SELECT 1 FROM t2 WHERE y=0
    721     )
    722   }
    723 } {0}
    724 
    725 
    726 
    727 
    728 finish_test
    729