AryaWu/sqlite
0
1# 2014-03-042#3# The author disclaims copyright to this source code. In place of4# 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# This file implements tests to verify that ticket [4ef7e3cfca] has been13# fixed.14#15 16set testdir [file dirname $argv0]17source $testdir/tester.tcl18set testprefix tkt-4ef7e3cfca19 20do_catchsql_test 1.1 {21 CREATE TABLE x(a);22 CREATE TRIGGER t AFTER INSERT ON x BEGIN23 SELECT * FROM x WHERE abc.a = 1;24 END;25 INSERT INTO x VALUES('assert');26} {1 {no such column: abc.a}}27 28reset_db29do_execsql_test 2.1 {30 CREATE TABLE w(a);31 CREATE TABLE x(a);32 CREATE TABLE y(a);33 CREATE TABLE z(a);34 35 INSERT INTO x(a) VALUES(5);36 INSERT INTO y(a) VALUES(10);37 38 CREATE TRIGGER t AFTER INSERT ON w BEGIN39 INSERT INTO z40 SELECT (SELECT x.a + y.a FROM y) FROM x;41 END;42 INSERT INTO w VALUES('incorrect');43}44do_execsql_test 2.2 {45 SELECT * FROM z;46} {15}47 48reset_db49do_execsql_test 3.1 {50 CREATE TABLE w(a);51 CREATE TABLE x(b);52 CREATE TABLE y(a);53 CREATE TABLE z(a);54 55 INSERT INTO x(b) VALUES(5);56 INSERT INTO y(a) VALUES(10);57 58 CREATE TRIGGER t AFTER INSERT ON w BEGIN59 INSERT INTO z60 SELECT (SELECT x.b + y.a FROM y) FROM x;61 END;62 INSERT INTO w VALUES('assert');63}64do_execsql_test 3.2 {65 SELECT * FROM z;66} {15}67 68finish_test69 