3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #*************************************************************************
13 set testdir [file dirname $argv0]
14 source $testdir/tester.tcl
15 source $testdir/malloc_common.tcl
16 set testprefix altermalloc3
18 # If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
19 ifcapable !altertable {
25 set ::TMPDBERROR [list 1 \
26 {unable to open a temporary database file for storing temporary tables}
29 sqlite3_db_config db SQLITE_DBCONFIG_DQS_DDL 1
32 one, two, three, PRIMARY KEY(one),
33 CHECK (three!="xyz"), CHECK (two!="one")
35 CREATE INDEX x1i ON x1(one+"two"+"four") WHERE "five";
36 CREATE TEMP TRIGGER AFTER INSERT ON x1 BEGIN
37 UPDATE x1 SET two=new.three || "new" WHERE one=new.one||"";
39 CREATE TABLE t1(a, b, c, d, PRIMARY KEY(d, b)) WITHOUT ROWID;
40 INSERT INTO t1 VALUES(1, 2, 3, 4);
42 faultsim_save_and_close
44 do_faultsim_test 1 -prep {
45 faultsim_restore_and_reopen
47 execsql { ALTER TABLE t1 DROP COLUMN c }
49 faultsim_test_result {0 {}} $::TMPDBERROR
53 #-------------------------------------------------------------------------
54 # dbsqlfuzz e3dd84cda3848016a6a6024c7249d09bc2ef2615
59 CREATE TRIGGER r2 AFTER INSERT ON t2 BEGIN
60 UPDATE t2 SET (k,v)= (
61 (WITH cte1(a) AS ( SELECT 1 FROM ( SELECT * FROM t2 ) )
66 CREATE TRIGGER r1 AFTER INSERT ON t2 BEGIN
67 UPDATE t2 SET k=1 FROM t2 AS one, t2 AS two NATURAL JOIN t2 AS three
72 faultsim_save_and_close
73 faultsim_restore_and_reopen
76 ALTER TABLE t2 RENAME TO t2x;
79 do_faultsim_test 2.2 -prep {
80 faultsim_restore_and_reopen
81 db eval { SELECT * FROM sqlite_master }
84 ALTER TABLE t2 RENAME TO t2x;
87 faultsim_test_result {0 {}} $::TMPDBERROR