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.
24
PRAGMA page_size=1024;
25
PRAGMA max_page_count=40;
27
CREATE TABLE filler (fill);
33
for {set i 0} {$i<34} {incr i} {
34
db eval {INSERT INTO filler VALUES(randomblob(1024))}
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.
45
INSERT INTO filler VALUES(randomblob(1024))
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.
54
db eval {PRAGMA max_page_count=41}
56
INSERT INTO filler VALUES(randomblob(2048))
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.
65
db eval {PRAGMA max_page_count=42}
67
INSERT INTO filler VALUES(randomblob(2048))
70
integrity_check tkt2920-1.8
72
# The previous errors cancelled the transaction.
76
} {1 {cannot commit - no transaction is active}}