sqlite/test/altertab3.test

48 lines
1.0 KiB
Plaintext
Raw Normal View History

# 2019 January 23
#
# 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 altertab3
# If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
ifcapable !altertable {
finish_test
return
}
do_execsql_test 1.0 {
CREATE TABLE t1(a, b);
CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
SELECT sum(b) OVER w FROM t1 WINDOW w AS (ORDER BY a);
END;
}
do_execsql_test 1.1 {
ALTER TABLE t1 RENAME a TO aaa;
}
do_execsql_test 1.2 {
SELECT sql FROM sqlite_master WHERE name='tr1'
} {{CREATE TRIGGER tr1 AFTER INSERT ON t1 BEGIN
SELECT sum(b) OVER w FROM t1 WINDOW w AS (ORDER BY aaa);
END}}
do_execsql_test 1.3 {
INSERT INTO t1 VALUES(1, 2);
}
finish_test