xref: /sqlite-3.40.0/test/softheap1.test (revision 3aefabaf)
1# 2007 Aug 10
2#
3# The author disclaims copyright to this source code.  In place of
4# a legal notice, here is a blessing:
5#
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.
9#
10#***********************************************************************
11#
12# This test script reproduces the problem reported by ticket #2565,
13# A database corruption bug that occurs in auto_vacuum mode when
14# the soft_heap_limit is set low enough to be triggered.
15#
16# $Id: softheap1.test,v 1.2 2007/08/12 20:07:59 drh Exp $
17
18
19set testdir [file dirname $argv0]
20source $testdir/tester.tcl
21
22sqlite3_soft_heap_limit 5000
23do_test softheap1-1.1 {
24  execsql {
25    PRAGMA auto_vacuum=1;
26    CREATE TABLE t1(x);
27    INSERT INTO t1 VALUES(hex(randomblob(1000)));
28    BEGIN;
29  }
30  execsql {
31    CREATE TABLE t2 AS SELECT * FROM t1;
32  }
33  execsql {
34    ROLLBACK;
35  }
36  execsql {
37    PRAGMA integrity_check;
38  }
39} {ok}
40sqlite3_soft_heap_limit $soft_limit
41
42finish_test
43