xref: /sqlite-3.40.0/test/altertab2.test (revision 84c501ba)
1# 2018 September 30
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
13set testdir [file dirname $argv0]
14source $testdir/tester.tcl
15set testprefix altertab
16
17# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
18ifcapable !altertable {
19  finish_test
20  return
21}
22
23ifcapable fts5 {
24  do_execsql_test 1.0 {
25    CREATE TABLE rr(a, b);
26    CREATE VIRTUAL TABLE ff USING fts5(a, b);
27    CREATE TRIGGER tr1 AFTER INSERT ON rr BEGIN
28      INSERT INTO ff VALUES(new.a, new.b);
29    END;
30    INSERT INTO rr VALUES('hello', 'world');
31    SELECT * FROM ff;
32  } {hello world}
33
34  do_execsql_test 1.1 {
35    ALTER TABLE ff RENAME TO ffff;
36  }
37
38  do_execsql_test 1.2 {
39    INSERT INTO rr VALUES('in', 'tcl');
40    SELECT * FROM ffff;
41  } {hello world in tcl}
42}
43
44
45finish_test
46
47