/ Check-in [d91e57e4]
Login

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

Overview
Comment:Add another test case for bug [5e3c8867].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d91e57e49f23414ec9211b775eb11cd6230a4f96
User & Date: dan 2016-03-09 15:14:54
Context
2016-03-09
15:34
Slight simplification to the query optimizer logic associated with IN (SELECT). check-in: 2c55c3c2 user: drh tags: trunk
15:14
Add another test case for bug [5e3c8867]. check-in: d91e57e4 user: dan tags: trunk
15:09
When optimizing expressions of the form "x IN (SELECT ...)" make sure that the subquery is not correlated. Fix for ticket [5e3c886796e5512]. check-in: 1ed6b06e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/in5.test.

   178    178   do_execsql_test 6.3.1 {
   179    179     CREATE TABLE x1(a);
   180    180     CREATE TABLE x2(b);
   181    181     INSERT INTO x1 VALUES(1), (1), (2);
   182    182     INSERT INTO x2 VALUES(1), (2);
   183    183     SELECT count(*) FROM x2 WHERE b IN (SELECT DISTINCT a FROM x1 LIMIT 2);
   184    184   } {2}
          185  +
          186  +#-------------------------------------------------------------------------
          187  +# Test to confirm that bug [5e3c886796e5] is fixed.
          188  +#
          189  +do_execsql_test 7.1 {
          190  +  CREATE TABLE y1(a, b);
          191  +  CREATE TABLE y2(c);
          192  +
          193  +  INSERT INTO y1 VALUES(1,     'one');
          194  +  INSERT INTO y1 VALUES('two', 'two');
          195  +  INSERT INTO y1 VALUES(3,     'three');
          196  +
          197  +  INSERT INTO y2 VALUES('one');
          198  +  INSERT INTO y2 VALUES('two');
          199  +  INSERT INTO y2 VALUES('three');
          200  +} {}
          201  +
          202  +do_execsql_test 7.2.1 {
          203  +  SELECT a FROM y1 WHERE b NOT IN (SELECT a FROM y2);
          204  +} {1 3}
          205  +do_execsql_test 7.2.2 {
          206  +  SELECT a FROM y1 WHERE b IN (SELECT a FROM y2);
          207  +} {two}
          208  +
          209  +do_execsql_test 7.3.1 {
          210  +  CREATE INDEX y2c ON y2(c);
          211  +  SELECT a FROM y1 WHERE b NOT IN (SELECT a FROM y2);
          212  +} {1 3}
          213  +do_execsql_test 7.3.2 {
          214  +  SELECT a FROM y1 WHERE b IN (SELECT a FROM y2);
          215  +} {two}
          216  +
          217  +finish_test
          218  +
          219  +
   185    220   
   186    221   finish_test