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