OLD | NEW |
1 # 2013-11-02 | 1 # 2013-11-02 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 catchsql { ALTER TABLE t2 ADD COLUMN f REFERENCES t1 DEFAULT 'text'} | 1024 catchsql { ALTER TABLE t2 ADD COLUMN f REFERENCES t1 DEFAULT 'text'} |
1025 } {1 {Cannot add a REFERENCES column with non-NULL default value}} | 1025 } {1 {Cannot add a REFERENCES column with non-NULL default value}} |
1026 do_test without_rowid3-14.1tmp.5 { | 1026 do_test without_rowid3-14.1tmp.5 { |
1027 catchsql { ALTER TABLE t2 ADD COLUMN g DEFAULT CURRENT_TIME REFERENCES t1 } | 1027 catchsql { ALTER TABLE t2 ADD COLUMN g DEFAULT CURRENT_TIME REFERENCES t1 } |
1028 } {1 {Cannot add a REFERENCES column with non-NULL default value}} | 1028 } {1 {Cannot add a REFERENCES column with non-NULL default value}} |
1029 do_test without_rowid3-14.1tmp.6 { | 1029 do_test without_rowid3-14.1tmp.6 { |
1030 execsql { | 1030 execsql { |
1031 PRAGMA foreign_keys = off; | 1031 PRAGMA foreign_keys = off; |
1032 ALTER TABLE t2 ADD COLUMN h DEFAULT 'text' REFERENCES t1; | 1032 ALTER TABLE t2 ADD COLUMN h DEFAULT 'text' REFERENCES t1; |
1033 PRAGMA foreign_keys = on; | 1033 PRAGMA foreign_keys = on; |
1034 SELECT sql FROM sqlite_temp_master WHERE name='t2'; | 1034 SELECT sql FROM temp.sqlite_master WHERE name='t2'; |
1035 } | 1035 } |
1036 } {{CREATE TABLE t2(a, b, c REFERENCES t1, d DEFAULT NULL REFERENCES t1, e REF
ERENCES t1 DEFAULT NULL, h DEFAULT 'text' REFERENCES t1)}} | 1036 } {{CREATE TABLE t2(a, b, c REFERENCES t1, d DEFAULT NULL REFERENCES t1, e REF
ERENCES t1 DEFAULT NULL, h DEFAULT 'text' REFERENCES t1)}} |
1037 | 1037 |
1038 do_test without_rowid3-14.2tmp.1.1 { | 1038 do_test without_rowid3-14.2tmp.1.1 { |
1039 test_rename_parent {CREATE TABLE t1(a REFERENCES t2)} t2 t3 | 1039 test_rename_parent {CREATE TABLE t1(a REFERENCES t2)} t2 t3 |
1040 } {{CREATE TABLE t1(a REFERENCES "t3")}} | 1040 } {{CREATE TABLE t1(a REFERENCES "t3")}} |
1041 do_test without_rowid3-14.2tmp.1.2 { | 1041 do_test without_rowid3-14.2tmp.1.2 { |
1042 test_rename_parent {CREATE TABLE t1(a REFERENCES t2)} t4 t3 | 1042 test_rename_parent {CREATE TABLE t1(a REFERENCES t2)} t4 t3 |
1043 } {{CREATE TABLE t1(a REFERENCES t2)}} | 1043 } {{CREATE TABLE t1(a REFERENCES t2)}} |
1044 do_test without_rowid3-14.2tmp.1.3 { | 1044 do_test without_rowid3-14.2tmp.1.3 { |
(...skipping 12 matching lines...) Expand all Loading... |
1057 } | 1057 } |
1058 execsql { SELECT sql FROM sqlite_temp_master WHERE type = 'table'} | 1058 execsql { SELECT sql FROM sqlite_temp_master WHERE type = 'table'} |
1059 } [list \ | 1059 } [list \ |
1060 {CREATE TABLE t1(a PRIMARY KEY, b REFERENCES t1) WITHOUT rowid} \ | 1060 {CREATE TABLE t1(a PRIMARY KEY, b REFERENCES t1) WITHOUT rowid} \ |
1061 {CREATE TABLE t2(a PRIMARY KEY, b REFERENCES t1, c REFERENCES t2) | 1061 {CREATE TABLE t2(a PRIMARY KEY, b REFERENCES t1, c REFERENCES t2) |
1062 WITHOUT rowid} \ | 1062 WITHOUT rowid} \ |
1063 {CREATE TABLE t3(a REFERENCES t1, b REFERENCES t2, c REFERENCES t1)} \ | 1063 {CREATE TABLE t3(a REFERENCES t1, b REFERENCES t2, c REFERENCES t1)} \ |
1064 ] | 1064 ] |
1065 do_test without_rowid3-14.2tmp.2.2 { | 1065 do_test without_rowid3-14.2tmp.2.2 { |
1066 execsql { ALTER TABLE t1 RENAME TO t4 } | 1066 execsql { ALTER TABLE t1 RENAME TO t4 } |
1067 execsql { SELECT sql FROM sqlite_temp_master WHERE type = 'table'} | 1067 execsql { SELECT sql FROM temp.sqlite_master WHERE type = 'table'} |
1068 } [list \ | 1068 } [list \ |
1069 {CREATE TABLE "t4"(a PRIMARY KEY, b REFERENCES "t4") WITHOUT rowid} \ | 1069 {CREATE TABLE "t4"(a PRIMARY KEY, b REFERENCES "t4") WITHOUT rowid} \ |
1070 {CREATE TABLE t2(a PRIMARY KEY, b REFERENCES "t4", c REFERENCES t2) | 1070 {CREATE TABLE t2(a PRIMARY KEY, b REFERENCES "t4", c REFERENCES t2) |
1071 WITHOUT rowid} \ | 1071 WITHOUT rowid} \ |
1072 {CREATE TABLE t3(a REFERENCES "t4", b REFERENCES t2, c REFERENCES "t4")} \ | 1072 {CREATE TABLE t3(a REFERENCES "t4", b REFERENCES t2, c REFERENCES "t4")} \ |
1073 ] | 1073 ] |
1074 do_test without_rowid3-14.2tmp.2.3 { | 1074 do_test without_rowid3-14.2tmp.2.3 { |
1075 catchsql { INSERT INTO t3 VALUES(1, 2, 3) } | 1075 catchsql { INSERT INTO t3 VALUES(1, 2, 3) } |
1076 } {1 {FOREIGN KEY constraint failed}} | 1076 } {1 {FOREIGN KEY constraint failed}} |
1077 do_test without_rowid3-14.2tmp.2.4 { | 1077 do_test without_rowid3-14.2tmp.2.4 { |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 CREATE TABLE t2(a,b,PRIMARY KEY(a,b)) WITHOUT ROWID; | 2091 CREATE TABLE t2(a,b,PRIMARY KEY(a,b)) WITHOUT ROWID; |
2092 INSERT INTO t1 VALUES(1,2),(3,4),(5,6); | 2092 INSERT INTO t1 VALUES(1,2),(3,4),(5,6); |
2093 SELECT changes(); | 2093 SELECT changes(); |
2094 } {3} | 2094 } {3} |
2095 do_execsql_test without_rowid3-30.2 { | 2095 do_execsql_test without_rowid3-30.2 { |
2096 INSERT INTO t2 SELECT * FROM t1; | 2096 INSERT INTO t2 SELECT * FROM t1; |
2097 SELECT changes(); | 2097 SELECT changes(); |
2098 } {3} | 2098 } {3} |
2099 | 2099 |
2100 finish_test | 2100 finish_test |
OLD | NEW |