Small performance optimization in sqlite3VdbeRecordCompareWithSkip() for
[sqlite.git] / test / tkt2920.test
blobd76c05bab95fe3c2cafa2893a26c733882dd4ad5
1 # 2008 Feb 1
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 #***********************************************************************
12 # This file is to test that ticket #2920 is fixed.
14 # $Id: tkt2920.test,v 1.1 2008/02/02 02:48:52 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 # Create a database file that is full.
22 do_test tkt2920-1.1 {
23   db eval {
24     PRAGMA page_size=1024;
25     PRAGMA max_page_count=40;
26     PRAGMA auto_vacuum=0;
27     CREATE TABLE filler (fill);
28   }
29   file size test.db
30 } {2048}
31 do_test tkt2920-1.2 {
32   db eval BEGIN
33   for {set i 0} {$i<34} {incr i} {
34     db eval {INSERT INTO filler VALUES(randomblob(1024))}
35   }
36   db eval COMMIT
37 }  {}
39 # Try to add a single new page to the full database.  We get
40 # a disk full error.  But this does not corrupt the database.
42 do_test tkt2920-1.3 {
43   db eval BEGIN
44   catchsql {
45      INSERT INTO filler VALUES(randomblob(1024))
46   }
47 } {1 {database or disk is full}}
48 integrity_check tkt2920-1.4
50 # Increase the maximum size of the database file by 1 page,
51 # but then try to add a two-page record.  This also fails.
53 do_test tkt2920-1.5 {
54   db eval {PRAGMA max_page_count=41}
55   catchsql {
56      INSERT INTO filler VALUES(randomblob(2048))
57   }
58 } {1 {database or disk is full}}
59 integrity_check tkt2920-1.6
61 # Increase the maximum size of the database by one more page.
62 # This time the insert works.
64 do_test tkt2920-1.7 {
65   db eval {PRAGMA max_page_count=42}
66   catchsql {
67      INSERT INTO filler VALUES(randomblob(2048))
68   }
69 } {0 {}}
70 integrity_check tkt2920-1.8
72 # The previous errors cancelled the transaction.
74 do_test tkt2920-1.9 {
75   catchsql {COMMIT}
76 } {1 {cannot commit - no transaction is active}}
78 finish_test