SQLite

Check-in [417aa1580a]
Login

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

Overview
Comment:Add a test case to join.test. No code changes, no bugs found. (CVS 5384)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 417aa1580abec8cc335dcb6ac36245c081a31ef8
User & Date: danielk1977 2008-07-09 14:47:21.000
Context
2008-07-09
16:51
Test coverage improvements on printf. (CVS 5385) (check-in: 2d8f7bebf0 user: drh tags: trunk)
14:47
Add a test case to join.test. No code changes, no bugs found. (CVS 5384) (check-in: 417aa1580a user: danielk1977 tags: trunk)
13:28
Begin adding the failsafe() macro. (CVS 5383) (check-in: 8aae4fe7e7 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/join.test.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for joins, including outer joins.
#
# $Id: join.test,v 1.23 2008/07/08 23:40:20 drh Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test join-1.1 {
  execsql {
    CREATE TABLE t1(a,b,c);







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests for joins, including outer joins.
#
# $Id: join.test,v 1.24 2008/07/09 14:47:21 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

do_test join-1.1 {
  execsql {
    CREATE TABLE t1(a,b,c);
464
465
466
467
468
469
470

471
472
473
474
475
476
477
478
479
480
481
482
483




















484
485
486
        EXCEPT
        SELECT * FROM t12 NATURAL LEFT JOIN v13;
    }
  } {}
} ;# ifcapable view
} ;# ifcapable compound


# Ticket #1697:  Left Join WHERE clause terms that contain an
# aggregate subquery.
#
ifcapable subquery {
do_test join-10.1 {
  execsql {
    CREATE TABLE t21(a,b,c);
    CREATE TABLE t22(p,q);
    CREATE INDEX i22 ON t22(q);
    SELECT a FROM t21 LEFT JOIN t22 ON b=p WHERE q=
       (SELECT max(m.q) FROM t22 m JOIN t21 n ON n.b=m.p WHERE n.c=1);
  }  
} {}




















} ;# ifcapable subquery

finish_test







>
|
|
|
<
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>



464
465
466
467
468
469
470
471
472
473
474

475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
        EXCEPT
        SELECT * FROM t12 NATURAL LEFT JOIN v13;
    }
  } {}
} ;# ifcapable view
} ;# ifcapable compound

ifcapable subquery {
  # Ticket #1697:  Left Join WHERE clause terms that contain an
  # aggregate subquery.
  #

  do_test join-10.1 {
    execsql {
      CREATE TABLE t21(a,b,c);
      CREATE TABLE t22(p,q);
      CREATE INDEX i22 ON t22(q);
      SELECT a FROM t21 LEFT JOIN t22 ON b=p WHERE q=
         (SELECT max(m.q) FROM t22 m JOIN t21 n ON n.b=m.p WHERE n.c=1);
    }  
  } {}

  # Test a LEFT JOIN when the right-hand side of hte join is an empty
  # sub-query. Seems fine.
  #
  do_test join-10.2 {
    execsql {
      CREATE TABLE t23(a, b, c);
      CREATE TABLE t24(a, b, c);
      INSERT INTO t23 VALUES(1, 2, 3);
    }
    execsql {
      SELECT * FROM t23 LEFT JOIN t24;
    }
  } {1 2 3 {} {} {}}
  do_test join-10.3 {
    execsql {
      SELECT * FROM t23 LEFT JOIN (SELECT * FROM t24);
    }
  } {1 2 3 {} {} {}}

} ;# ifcapable subquery

finish_test