1: # 2009 June 23
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: # Tests to verify ticket #3929 is fixed.
13: #
14: # $Id: tkt3929.test,v 1.1.1.1 2012/02/21 17:04:16 misho Exp $
15:
16: set testdir [file dirname $argv0]
17: source $testdir/tester.tcl
18: ifcapable {!trigger} {
19: finish_test
20: return
21: }
22:
23: do_test tkt3929-1.0 {
24: execsql {
25: PRAGMA page_size = 1024;
26: CREATE TABLE t1(a, b);
27: CREATE INDEX i1 ON t1(a, b);
28: CREATE TRIGGER t1_t1 AFTER INSERT ON t1 BEGIN
29: UPDATE t1 SET b = 'value: ' || a WHERE t1.rowid = new.rowid;
30: END;
31: }
32: } {}
33:
34: do_test tkt3929-1.1 {
35: execsql {
36: INSERT INTO t1(a) VALUES(1);
37: INSERT INTO t1(a) VALUES(2);
38: SELECT * FROM t1;
39: }
40: } {1 {value: 1} 2 {value: 2}}
41:
42: # Before it was fixed, the following provoked the bug, causing either an
43: # assertion failure or a "database is malformed" error.
44: #
45: do_test tkt3930-1.2 {
46: for {set i 3} {$i < 100} {incr i} {
47: execsql { INSERT INTO t1(a) VALUES($i) }
48: }
49: } {}
50:
51: integrity_check tkt3930-1.3
52: finish_test
53:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>