Do not even try star-schema detection if the join has fewer than 5 tables,
[sqlite.git] / test / vtabE.test
blobcbb6a1e30a622cdb81700a97f1cdbdffaca9b16f
1 # 2009 November 23
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.
13 # The focus of this file making sure the register cache logic works
14 # correctly with virtual tables.  Ticket [16fbf14cb2].
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 ifcapable !vtab {
21   finish_test
22   return
25 register_tclvar_module [sqlite3_connection_pointer db]
27 unset -nocomplain vtabE
28 set vtabE(vtabE1) 11
29 set vtabE(vtabE2) 22
30 unset -nocomplain vtabE1
31 set vtabE1(w) x
32 set vtabE1(y) z
33 unset -nocomplain vtabE2
34 set vtabE2(a) b
35 set vtabE2(c) d
37 do_test vtabE-1 {
38   db eval {
39     CREATE VIRTUAL TABLE t1 USING tclvar;
40     CREATE VIRTUAL TABLE t2 USING tclvar;
41     CREATE TABLE t3(a INTEGER PRIMARY KEY, b);
42     SELECT t1.name, t1.arrayname, t1.value,
43            t2.name, t2.arrayname, t2.value,
44            abs(t3.b + abs(t2.value + abs(t1.value)))
45       FROM t1 LEFT JOIN t2 ON t2.name = t1.arrayname
46            LEFT JOIN t3 ON t3.a=t2.value
47      WHERE t1.name = 'vtabE'
48      ORDER BY t1.value, t2.value;
49   }
50 } {vtabE vtabE1 11 vtabE1 w x {} vtabE vtabE1 11 vtabE1 y z {} vtabE vtabE2 22 vtabE2 a b {} vtabE vtabE2 22 vtabE2 c d {}}
52 finish_test