gitlab.com/CoiaPrant/sqlite3@v1.19.1/testdata/tcl/tkt-4ef7e3cfca.test (about)

     1  # 2014-03-04
     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  # This file implements tests to verify that ticket [4ef7e3cfca] has been
    13  # fixed.
    14  #
    15  
    16  set testdir [file dirname $argv0]
    17  source $testdir/tester.tcl
    18  set testprefix tkt-4ef7e3cfca
    19  
    20  do_catchsql_test 1.1 {
    21    CREATE TABLE x(a);
    22    CREATE TRIGGER t AFTER INSERT ON x BEGIN
    23      SELECT * FROM x WHERE abc.a = 1;
    24    END;
    25    INSERT INTO x VALUES('assert');
    26  } {1 {no such column: abc.a}}
    27  
    28  reset_db
    29  do_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 BEGIN
    39      INSERT INTO z
    40      SELECT (SELECT x.a + y.a FROM y) FROM x;
    41    END;
    42    INSERT INTO w VALUES('incorrect');
    43  }
    44  do_execsql_test 2.2 {
    45    SELECT * FROM z;
    46  } {15}
    47  
    48  reset_db
    49  do_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 BEGIN
    59      INSERT INTO z
    60      SELECT (SELECT x.b + y.a FROM y) FROM x;
    61    END;
    62    INSERT INTO w VALUES('assert');
    63  }
    64  do_execsql_test 3.2 {
    65    SELECT * FROM z;
    66  } {15}
    67  
    68  finish_test