ADDED test/tkt3810.test Index: test/tkt3810.test ================================================================== --- /dev/null +++ test/tkt3810.test @@ -0,0 +1,53 @@ +# 2009 August 1 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# +# Tests to make sure #3810 is fixed. +# +# $Id: tkt3810.test,v 1.1 2009/08/01 15:54:26 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# Create a table using the first database connection. +# +do_test tkt3810-1 { + execsql { + CREATE TABLE t1(x); + INSERT INTO t1 VALUES(123); + SELECT * FROM t1; + } +} 123 + +# Create a second connection to the same database. Make sure the +# schema of the database has been parsed by the second connection. +# +do_test tkt3810-2 { + sqlite3 db2 test.db + execsql { + SELECT * FROM t1; + } db2 +} 123 + +# DROP the table using the second connection. The table no longer exists +# but the first connection does not yet know this. Then try to create a TEMP +# trigger in the first connection that references the table that was dropped. +# +do_test tkt3810-3 { + execsql {DROP TABLE t1} db2 + execsql { + CREATE TEMP TRIGGER r1 AFTER INSERT ON t1 BEGIN + INSERT INTO t1 VALUES(2345); + END; + SELECT * FROM t1; + } +} {} + +finish_test