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 # Tests to make sure #3810 is fixed.
14 # $Id: tkt3810.test,v 1.4 2009/08/06 17:43:31 drh Exp $
16 set testdir [file dirname $argv0]
17 source $testdir/tester.tcl
18 ifcapable {!trigger} {
23 # Create a table using the first database connection.
28 INSERT INTO t1 VALUES(123);
35 # Create a second connection to the same database. Make sure the
36 # schema of the database has been parsed by the second connection.
45 # DROP the table using the second connection. The table no longer exists
46 # but the first connection does not yet know this. Then try to create a TEMP
47 # trigger in the first connection that references the table that was dropped.
50 execsql {DROP TABLE t1} db2
52 CREATE TEMP TRIGGER r1 AFTER INSERT ON t1 BEGIN
53 INSERT INTO t2 VALUES(new.rowid);
61 # Trigger still exists in the sqlite_temp_master table, but now it is
65 execsql {SELECT name FROM temp.sqlite_master ORDER BY name}
68 # Because it is an orphan, it cannot be dropped.
71 catchsql {DROP TRIGGER r1}
72 } {1 {no such trigger: r1}}
74 # Create a table t1 then drop the table in order to drop the orphaned
78 execsql {CREATE TABLE t1(x)} db2
79 execsql {DROP TABLE t1}
81 SELECT name FROM sqlite_temp_master;