xref: /titanic_52/usr/src/lib/libsqlite/test/crashme2.off (revision ac88567a7a5bb7f01cf22cf366bc9d6203e24d7a)
1
2#pragma ident	"%Z%%M%	%I%	%E% SMI"
3
4
5set testdir [file dirname $argv0]
6source $testdir/tester.tcl
7
8db close
9set DB [sqlite db test.db]
10
11execsql {
12  CREATE TABLE t1(a);
13  INSERT INTO t1 VALUES(1);
14  INSERT INTO t1 VALUES(2);
15  INSERT INTO t1 VALUES(3);
16  INSERT INTO t1 VALUES(4);
17}
18
19do_test capi3-13.1 {
20  execsql {
21    CREATE TABLE t3(a unique on conflict rollback);
22    INSERT INTO t3 SELECT a FROM t1;
23    BEGIN;
24    INSERT INTO t1 SELECT * FROM t1;
25  }
26} {}
27do_test capi3-13.2 {
28  set STMT [sqlite_compile $DB "SELECT a FROM t1" TAIL]
29  sqlite_step $STMT
30  sqlite_step $STMT
31  sqlite_step $STMT
32  sqlite_step $STMT
33  sqlite_step $STMT
34} {SQLITE_ROW}
35do_test capi3-13.3 {
36# This causes a ROLLBACK, which deletes the table out from underneath the
37# SELECT statement. Causes a crash.
38  catchsql {
39    INSERT INTO t3 SELECT a FROM t1;
40  }
41} {1 {column a is not unique}}
42do_test capi3-13.4 {
43  sqlite_step $STMT
44  sqlite_step $STMT
45  sqlite_step $STMT
46  sqlite_step $STMT
47} {SQLITE_DONE}
48do_test capi3-13.5 {
49  sqlite_finalize $STMT
50} {SQLITE_OK}
51
52finish_test
53