# 2017-03-24 # # 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. # #*********************************************************************** # set testdir [file dirname $argv0] source $testdir/tester.tcl set testprefix triggerG ifcapable {!trigger} { finish_test return } # Test cases for ticket # https://www.sqlite.org/src/tktview/06796225f59c057cd120f # # The OP_Once opcode was not working correctly for recursive triggers. # do_execsql_test 100 { PRAGMA recursive_triggers = 1; CREATE TABLE t1(a); CREATE INDEX i1 ON t1(a); INSERT INTO t1(a) VALUES(0),(2),(3),(8),(9); CREATE TABLE t2(b); CREATE TABLE t3(c); CREATE TRIGGER tr AFTER INSERT ON t3 BEGIN INSERT INTO t3 SELECT new.c+1 WHERE new.c<5; INSERT INTO t2 SELECT new.c*100+a FROM t1 WHERE a IN (1, 2, 3, 4); END; INSERT INTO t3 VALUES(2); SELECT c FROM t3 ORDER BY c;; } {2 3 4 5} do_execsql_test 110 { SELECT b FROM t2 ORDER BY b; } {202 203 302 303 402 403 502 503} finish_test