summaryrefslogtreecommitdiffstats
path: root/test/tkt-d82e3f3721.test
blob: da932d1eaa8a5c66ed6f910c46bcbf8c3b9d9891 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# 2009 September 2
#
# The author disclaims copyright to this source code.  In place of
# a legal notice, here is a blessing:
#
#    May you do good and not evil.
#    May you find forgiveness for yourself and forgive others.
#    May you share freely, never taking more than you give.
#
#***********************************************************************
# This file implements regression tests for SQLite library.
#
# This file implements tests to verify that ticket [d82e3f3721] has been
# fixed.  
#

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

ifcapable !compound {
  finish_test
  return
}

do_test tkt-d82e3-1.1 {
  db eval {
    CREATE TABLE t1(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
    INSERT INTO t1 VALUES(null,'abc');
    INSERT INTO t1 VALUES(null,'def');
    DELETE FROM t1;
    INSERT INTO t1 VALUES(null,'ghi');
    SELECT * FROM t1;
  }
} {3 ghi}
do_test tkt-d82e3-1.2 {
  db eval {
    CREATE TEMP TABLE t2(a INTEGER PRIMARY KEY AUTOINCREMENT, b);
    INSERT INTO t2 VALUES(null,'jkl');
    INSERT INTO t2 VALUES(null,'mno');
    DELETE FROM t2;
    INSERT INTO t2 VALUES(null,'pqr');
    SELECT * FROM t2;
  }
} {3 pqr}
do_test tkt-d82e3-1.3 {
  db eval {
    SELECT 'main', * FROM main.sqlite_sequence
    UNION ALL
    SELECT 'temp', * FROM temp.sqlite_sequence
    ORDER BY 2
  }
} {main t1 3 temp t2 3}
do_test tkt-d82e3-1.4 {
  db eval {
    VACUUM;
    SELECT 'main', * FROM main.sqlite_sequence
    UNION ALL
    SELECT 'temp', * FROM temp.sqlite_sequence
    ORDER BY 2
  }
} {main t1 3 temp t2 3}

sqlite3 db2 test.db
do_test tkt-d82e3-2.1 {
  db eval {
    CREATE TEMP TABLE t3(x);
    INSERT INTO t3 VALUES(1);
  }
  db2 eval {
    CREATE TABLE t3(y,z);
    INSERT INTO t3 VALUES(8,9);
  }
  db eval {
    SELECT * FROM temp.t3 JOIN main.t3;
  }
} {1 8 9}
do_test tkt-d82e3-2.2 {
  db eval {
    VACUUM;
    SELECT * FROM temp.t3 JOIN main.t3;
  }
} {1 8 9}
db2 close

finish_test