Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Unified Diff: third_party/sqlite/sqlite-src-3080704/test/conflict2.test

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/sqlite-src-3080704/test/conflict2.test
diff --git a/third_party/sqlite/sqlite-src-3070603/test/conflict.test b/third_party/sqlite/sqlite-src-3080704/test/conflict2.test
similarity index 78%
copy from third_party/sqlite/sqlite-src-3070603/test/conflict.test
copy to third_party/sqlite/sqlite-src-3080704/test/conflict2.test
index 17c7263f1ef2cf9a1aab3112b4926d675173c0e6..8419f1a3ff3f7a65e8100ae94859e0518d805108 100644
--- a/third_party/sqlite/sqlite-src-3070603/test/conflict.test
+++ b/third_party/sqlite/sqlite-src-3080704/test/conflict2.test
@@ -1,4 +1,4 @@
-# 2002 January 29
+# 2013-11-04
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
@@ -11,9 +11,8 @@
# This file implements regression tests for SQLite library.
#
# This file implements tests for the conflict resolution extension
-# to SQLite.
+# in WITHOUT ROWID tables
#
-# $Id: conflict.test,v 1.32 2009/04/30 09:10:38 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -25,9 +24,9 @@ ifcapable !conflict {
# Create tables for the first group of tests.
#
-do_test conflict-1.0 {
+do_test conflict2-1.0 {
execsql {
- CREATE TABLE t1(a, b, c, UNIQUE(a,b));
+ CREATE TABLE t1(a, b, c, PRIMARY KEY(a,b)) WITHOUT rowid;
CREATE TABLE t2(x);
SELECT c FROM t1 ORDER BY c;
}
@@ -51,7 +50,7 @@ foreach {i cmd t0 t1 t2 t3} {
6 {INSERT OR ABORT} 1 {} 1 0
7 {INSERT OR ROLLBACK} 1 {} {} 0
} {
- do_test conflict-1.$i {
+ do_test conflict2-1.$i {
set ::sqlite_opentemp_count 0
set r0 [catch {execsql [subst {
DELETE FROM t1;
@@ -71,11 +70,11 @@ foreach {i cmd t0 t1 t2 t3} {
# Create tables for the first group of tests.
#
-do_test conflict-2.0 {
+do_test conflict2-2.0 {
execsql {
DROP TABLE t1;
DROP TABLE t2;
- CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, UNIQUE(a,b));
+ CREATE TABLE t1(a INTEGER PRIMARY KEY, b, c, UNIQUE(a,b)) WITHOUT rowid;
CREATE TABLE t2(x);
SELECT c FROM t1 ORDER BY c;
}
@@ -98,7 +97,7 @@ foreach {i cmd t0 t1 t2} {
6 {INSERT OR ABORT} 1 {} 1
7 {INSERT OR ROLLBACK} 1 {} {}
} {
- do_test conflict-2.$i {
+ do_test conflict2-2.$i {
set r0 [catch {execsql [subst {
DELETE FROM t1;
DELETE FROM t2;
@@ -116,11 +115,11 @@ foreach {i cmd t0 t1 t2} {
# Create tables for the first group of tests.
#
-do_test conflict-3.0 {
+do_test conflict2-3.0 {
execsql {
DROP TABLE t1;
DROP TABLE t2;
- CREATE TABLE t1(a, b, c INTEGER, PRIMARY KEY(c), UNIQUE(a,b));
+ CREATE TABLE t1(a, b, c INTEGER, PRIMARY KEY(c), UNIQUE(a,b)) WITHOUT rowid;
CREATE TABLE t2(x);
SELECT c FROM t1 ORDER BY c;
}
@@ -143,7 +142,7 @@ foreach {i cmd t0 t1 t2} {
6 {INSERT OR ABORT} 1 {} 1
7 {INSERT OR ROLLBACK} 1 {} {}
} {
- do_test conflict-3.$i {
+ do_test conflict2-3.$i {
set r0 [catch {execsql [subst {
DELETE FROM t1;
DELETE FROM t2;
@@ -159,7 +158,7 @@ foreach {i cmd t0 t1 t2} {
} [list $t0 $t1 $t2]
}
-do_test conflict-4.0 {
+do_test conflict2-4.0 {
execsql {
DROP TABLE t2;
CREATE TABLE t2(x);
@@ -189,11 +188,11 @@ foreach {i conf1 cmd t0 t1 t2} {
10 ABORT {INSERT OR REPLACE} 0 4 1
11 ROLLBACK {INSERT OR IGNORE } 0 3 1
} {
- do_test conflict-4.$i {
+ do_test conflict2-4.$i {
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
set r0 [catch {execsql [subst {
DROP TABLE t1;
- CREATE TABLE t1(a,b,c,UNIQUE(a,b) $conf1);
+ CREATE TABLE t1(a,b,c,PRIMARY KEY(a,b) $conf1) WITHOUT rowid;
DELETE FROM t2;
INSERT INTO t1 VALUES(1,2,3);
BEGIN;
@@ -207,7 +206,7 @@ foreach {i conf1 cmd t0 t1 t2} {
} [list $t0 $t1 $t2]
}
-do_test conflict-5.0 {
+do_test conflict2-5.0 {
execsql {
DROP TABLE t2;
CREATE TABLE t2(x);
@@ -242,8 +241,8 @@ foreach {i conf1 cmd t0 t1 t2} {
15 {} {INSERT OR ABORT} 1 {} 1
16 {} {INSERT OR ROLLBACK} 1 {} {}
} {
- if {$t0} {set t1 {t1.c may not be NULL}}
- do_test conflict-5.$i {
+ if {$t0} {set t1 {NOT NULL constraint failed: t1.c}}
+ do_test conflict2-5.$i {
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
set r0 [catch {execsql [subst {
DROP TABLE t1;
@@ -260,7 +259,7 @@ foreach {i conf1 cmd t0 t1 t2} {
} [list $t0 $t1 $t2]
}
-do_test conflict-6.0 {
+do_test conflict2-6.0 {
execsql {
DROP TABLE t2;
CREATE TABLE t2(a,b,c);
@@ -296,23 +295,28 @@ foreach {i conf1 cmd t0 t1 t2 t3 t4} {
5 ABORT UPDATE 1 {1 2 3 4} 1 0 1
6 ROLLBACK UPDATE 1 {1 2 3 4} 0 0 0
7 REPLACE {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0
- 8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0
+ 8 IGNORE {UPDATE OR REPLACE} 0 {7 6 9} 1 0 1
9 FAIL {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0
- 10 ABORT {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0
+ 10 ABORT {UPDATE OR REPLACE} 0 {7 6 9} 1 0 1
11 ROLLBACK {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0
12 {} {UPDATE OR IGNORE} 0 {6 7 3 9} 1 0 0
- 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 0
+ 13 {} {UPDATE OR REPLACE} 0 {7 6 9} 1 0 1
14 {} {UPDATE OR FAIL} 1 {6 7 3 4} 1 0 0
15 {} {UPDATE OR ABORT} 1 {1 2 3 4} 1 0 1
16 {} {UPDATE OR ROLLBACK} 1 {1 2 3 4} 0 0 0
} {
- if {$t0} {set t1 {column a is not unique}}
+
+ # When using in-memory journals, no temporary files are required for
+ # statement journals.
+ if {[permutation] == "inmemory_journal"} { set t4 0 }
+
+ if {$t0} {set t1 {UNIQUE constraint failed: t1.a}}
if {[info exists TEMP_STORE] && $TEMP_STORE==3} {
set t3 0
} else {
set t3 [expr {$t3+$t4}]
}
- do_test conflict-6.$i {
+ do_test conflict2-6.$i {
db close
sqlite3 db test.db
if {$conf1!=""} {set conf1 "ON CONFLICT $conf1"}
@@ -320,7 +324,7 @@ foreach {i conf1 cmd t0 t1 t2 t3 t4} {
set ::sqlite_opentemp_count 0
set r0 [catch {execsql [subst {
DROP TABLE t1;
- CREATE TABLE t1(a,b,c, UNIQUE(a) $conf1);
+ CREATE TABLE t1(a,b,c, PRIMARY KEY(a) $conf1) WITHOUT rowid;
INSERT INTO t1 SELECT * FROM t2;
UPDATE t3 SET x=0;
BEGIN;
@@ -337,12 +341,12 @@ foreach {i conf1 cmd t0 t1 t2 t3 t4} {
# Test to make sure a lot of IGNOREs don't cause a stack overflow
#
-do_test conflict-7.1 {
+do_test conflict2-7.1 {
execsql {
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
- CREATE TABLE t1(a unique, b);
+ CREATE TABLE t1(a PRIMARY KEY, b) without rowid;
}
for {set i 1} {$i<=50} {incr i} {
execsql "INSERT into t1 values($i,[expr {$i+1}]);"
@@ -351,40 +355,35 @@ do_test conflict-7.1 {
SELECT count(*), min(a), max(b) FROM t1;
}
} {50 1 51}
-do_test conflict-7.2 {
+do_test conflict2-7.2 {
execsql {
PRAGMA count_changes=on;
UPDATE OR IGNORE t1 SET a=1000;
}
} {1}
-do_test conflict-7.2.1 {
+do_test conflict2-7.2.1 {
db changes
} {1}
-do_test conflict-7.3 {
+do_test conflict2-7.3 {
execsql {
SELECT b FROM t1 WHERE a=1000;
}
} {2}
-do_test conflict-7.4 {
+do_test conflict2-7.4 {
execsql {
SELECT count(*) FROM t1;
}
} {50}
-do_test conflict-7.5 {
+do_test conflict2-7.5 {
execsql {
PRAGMA count_changes=on;
UPDATE OR REPLACE t1 SET a=1001;
}
} {50}
-do_test conflict-7.5.1 {
+do_test conflict2-7.5.1 {
db changes
} {50}
-do_test conflict-7.6 {
- execsql {
- SELECT b FROM t1 WHERE a=1001;
- }
-} {51}
-do_test conflict-7.7 {
+do_test conflict2-7.7 {
execsql {
SELECT count(*) FROM t1;
}
@@ -392,14 +391,14 @@ do_test conflict-7.7 {
# Update for version 3: A SELECT statement no longer resets the change
# counter (Test result changes from 0 to 50).
-do_test conflict-7.7.1 {
+do_test conflict2-7.7.1 {
db changes
} {50}
# Make sure the row count is right for rows that are ignored on
# an insert.
#
-do_test conflict-8.1 {
+do_test conflict2-8.1 {
execsql {
DELETE FROM t1;
INSERT INTO t1 VALUES(1,2);
@@ -408,207 +407,214 @@ do_test conflict-8.1 {
INSERT OR IGNORE INTO t1 VALUES(2,3);
}
} {1}
-do_test conflict-8.1.1 {
+do_test conflict2-8.1.1 {
db changes
} {1}
-do_test conflict-8.2 {
+do_test conflict2-8.2 {
execsql {
INSERT OR IGNORE INTO t1 VALUES(2,4);
}
} {0}
-do_test conflict-8.2.1 {
+do_test conflict2-8.2.1 {
db changes
} {0}
-do_test conflict-8.3 {
+do_test conflict2-8.3 {
execsql {
INSERT OR REPLACE INTO t1 VALUES(2,4);
}
} {1}
-do_test conflict-8.3.1 {
+do_test conflict2-8.3.1 {
db changes
} {1}
-do_test conflict-8.4 {
+do_test conflict2-8.4 {
execsql {
INSERT OR IGNORE INTO t1 SELECT * FROM t1;
}
} {0}
-do_test conflict-8.4.1 {
+do_test conflict2-8.4.1 {
db changes
} {0}
-do_test conflict-8.5 {
+do_test conflict2-8.5 {
execsql {
INSERT OR IGNORE INTO t1 SELECT a+2,b+2 FROM t1;
}
} {2}
-do_test conflict-8.5.1 {
+do_test conflict2-8.5.1 {
db changes
} {2}
-do_test conflict-8.6 {
+do_test conflict2-8.6 {
execsql {
INSERT OR IGNORE INTO t1 SELECT a+3,b+3 FROM t1;
}
} {3}
-do_test conflict-8.6.1 {
+do_test conflict2-8.6.1 {
db changes
} {3}
-integrity_check conflict-8.99
+integrity_check conflict2-8.99
-do_test conflict-9.1 {
+do_test conflict2-9.1 {
execsql {
PRAGMA count_changes=0;
CREATE TABLE t2(
- a INTEGER UNIQUE ON CONFLICT IGNORE,
+ a INTEGER PRIMARY KEY ON CONFLICT IGNORE,
b INTEGER UNIQUE ON CONFLICT FAIL,
c INTEGER UNIQUE ON CONFLICT REPLACE,
d INTEGER UNIQUE ON CONFLICT ABORT,
e INTEGER UNIQUE ON CONFLICT ROLLBACK
- );
+ ) WITHOUT rowid;
CREATE TABLE t3(x);
INSERT INTO t3 VALUES(1);
SELECT * FROM t3;
}
} {1}
-do_test conflict-9.2 {
+do_test conflict2-9.2 {
catchsql {
INSERT INTO t2 VALUES(1,1,1,1,1);
INSERT INTO t2 VALUES(2,2,2,2,2);
SELECT * FROM t2;
}
} {0 {1 1 1 1 1 2 2 2 2 2}}
-do_test conflict-9.3 {
+do_test conflict2-9.3 {
catchsql {
INSERT INTO t2 VALUES(1,3,3,3,3);
SELECT * FROM t2;
}
} {0 {1 1 1 1 1 2 2 2 2 2}}
-do_test conflict-9.4 {
+do_test conflict2-9.4 {
catchsql {
UPDATE t2 SET a=a+1 WHERE a=1;
SELECT * FROM t2;
}
} {0 {1 1 1 1 1 2 2 2 2 2}}
-do_test conflict-9.5 {
+do_test conflict2-9.5 {
catchsql {
INSERT INTO t2 VALUES(3,1,3,3,3);
- SELECT * FROM t2;
}
-} {1 {column b is not unique}}
-do_test conflict-9.6 {
+} {1 {UNIQUE constraint failed: t2.b}}
+do_test conflict2-9.5b {
+ db eval {SELECT * FROM t2;}
+} {1 1 1 1 1 2 2 2 2 2}
+do_test conflict2-9.6 {
catchsql {
UPDATE t2 SET b=b+1 WHERE b=1;
SELECT * FROM t2;
}
-} {1 {column b is not unique}}
-do_test conflict-9.7 {
+} {1 {UNIQUE constraint failed: t2.b}}
+do_test conflict2-9.6b {
+ db eval {SELECT * FROM t2;}
+} {1 1 1 1 1 2 2 2 2 2}
+do_test conflict2-9.7 {
catchsql {
BEGIN;
UPDATE t3 SET x=x+1;
INSERT INTO t2 VALUES(3,1,3,3,3);
SELECT * FROM t2;
}
-} {1 {column b is not unique}}
-do_test conflict-9.8 {
+} {1 {UNIQUE constraint failed: t2.b}}
+do_test conflict2-9.8 {
execsql {COMMIT}
execsql {SELECT * FROM t3}
} {2}
-do_test conflict-9.9 {
+do_test conflict2-9.9 {
catchsql {
BEGIN;
UPDATE t3 SET x=x+1;
UPDATE t2 SET b=b+1 WHERE b=1;
SELECT * FROM t2;
}
-} {1 {column b is not unique}}
-do_test conflict-9.10 {
+} {1 {UNIQUE constraint failed: t2.b}}
+do_test conflict2-9.10 {
execsql {COMMIT}
execsql {SELECT * FROM t3}
} {3}
-do_test conflict-9.11 {
+do_test conflict2-9.11 {
catchsql {
INSERT INTO t2 VALUES(3,3,3,1,3);
SELECT * FROM t2;
}
-} {1 {column d is not unique}}
-do_test conflict-9.12 {
+} {1 {UNIQUE constraint failed: t2.d}}
+do_test conflict2-9.12 {
catchsql {
UPDATE t2 SET d=d+1 WHERE d=1;
SELECT * FROM t2;
}
-} {1 {column d is not unique}}
-do_test conflict-9.13 {
+} {1 {UNIQUE constraint failed: t2.d}}
+do_test conflict2-9.13 {
catchsql {
BEGIN;
UPDATE t3 SET x=x+1;
INSERT INTO t2 VALUES(3,3,3,1,3);
SELECT * FROM t2;
}
-} {1 {column d is not unique}}
-do_test conflict-9.14 {
+} {1 {UNIQUE constraint failed: t2.d}}
+do_test conflict2-9.14 {
execsql {COMMIT}
execsql {SELECT * FROM t3}
} {4}
-do_test conflict-9.15 {
+do_test conflict2-9.15 {
catchsql {
BEGIN;
UPDATE t3 SET x=x+1;
UPDATE t2 SET d=d+1 WHERE d=1;
SELECT * FROM t2;
}
-} {1 {column d is not unique}}
-do_test conflict-9.16 {
+} {1 {UNIQUE constraint failed: t2.d}}
+do_test conflict2-9.16 {
execsql {COMMIT}
execsql {SELECT * FROM t3}
} {5}
-do_test conflict-9.17 {
+do_test conflict2-9.17 {
catchsql {
INSERT INTO t2 VALUES(3,3,3,3,1);
SELECT * FROM t2;
}
-} {1 {column e is not unique}}
-do_test conflict-9.18 {
+} {1 {UNIQUE constraint failed: t2.e}}
+do_test conflict2-9.18 {
catchsql {
UPDATE t2 SET e=e+1 WHERE e=1;
SELECT * FROM t2;
}
-} {1 {column e is not unique}}
-do_test conflict-9.19 {
+} {1 {UNIQUE constraint failed: t2.e}}
+do_test conflict2-9.19 {
catchsql {
BEGIN;
UPDATE t3 SET x=x+1;
INSERT INTO t2 VALUES(3,3,3,3,1);
SELECT * FROM t2;
}
-} {1 {column e is not unique}}
-do_test conflict-9.20 {
+} {1 {UNIQUE constraint failed: t2.e}}
+verify_ex_errcode conflict2-9.21b SQLITE_CONSTRAINT_UNIQUE
+do_test conflict2-9.20 {
catch {execsql {COMMIT}}
execsql {SELECT * FROM t3}
} {5}
-do_test conflict-9.21 {
+do_test conflict2-9.21 {
catchsql {
BEGIN;
UPDATE t3 SET x=x+1;
UPDATE t2 SET e=e+1 WHERE e=1;
SELECT * FROM t2;
}
-} {1 {column e is not unique}}
-do_test conflict-9.22 {
+} {1 {UNIQUE constraint failed: t2.e}}
+verify_ex_errcode conflict2-9.21b SQLITE_CONSTRAINT_UNIQUE
+do_test conflict2-9.22 {
catch {execsql {COMMIT}}
execsql {SELECT * FROM t3}
} {5}
-do_test conflict-9.23 {
+do_test conflict2-9.23 {
catchsql {
INSERT INTO t2 VALUES(3,3,1,3,3);
SELECT * FROM t2;
}
} {0 {2 2 2 2 2 3 3 1 3 3}}
-do_test conflict-9.24 {
+do_test conflict2-9.24 {
catchsql {
UPDATE t2 SET c=c-1 WHERE c=2;
SELECT * FROM t2;
}
} {0 {2 2 1 2 2}}
-do_test conflict-9.25 {
+do_test conflict2-9.25 {
catchsql {
BEGIN;
UPDATE t3 SET x=x+1;
@@ -616,12 +622,12 @@ do_test conflict-9.25 {
SELECT * FROM t2;
}
} {0 {3 3 1 3 3}}
-do_test conflict-9.26 {
+do_test conflict2-9.26 {
catch {execsql {COMMIT}}
execsql {SELECT * FROM t3}
} {6}
-do_test conflict-10.1 {
+do_test conflict2-10.1 {
catchsql {
DELETE FROM t1;
BEGIN;
@@ -631,7 +637,7 @@ do_test conflict-10.1 {
}
execsql {SELECT * FROM t1}
} {}
-do_test conflict-10.2 {
+do_test conflict2-10.2 {
catchsql {
CREATE TABLE t4(x);
CREATE UNIQUE INDEX t4x ON t4(x);
@@ -646,11 +652,11 @@ do_test conflict-10.2 {
# Ticket #1171. Make sure statement rollbacks do not
# damage the database.
#
-do_test conflict-11.1 {
+do_test conflict2-11.1 {
execsql {
-- Create a database object (pages 2, 3 of the file)
BEGIN;
- CREATE TABLE abc(a UNIQUE, b, c);
+ CREATE TABLE abc(a PRIMARY KEY, b, c) WITHOUT rowid;
INSERT INTO abc VALUES(1, 2, 3);
INSERT INTO abc VALUES(4, 5, 6);
INSERT INTO abc VALUES(7, 8, 9);
@@ -702,11 +708,11 @@ do_test conflict-11.1 {
SELECT * FROM abc;
}
} {1 2 3 4 5 6 7 8 9}
-integrity_check conflict-11.2
+integrity_check conflict2-11.2
-# Repeat test conflict-11.1 but this time commit.
+# Repeat test conflict2-11.1 but this time commit.
#
-do_test conflict-11.3 {
+do_test conflict2-11.3 {
execsql {
BEGIN;
-- Make sure the pager is in EXCLUSIVE state.
@@ -731,9 +737,9 @@ do_test conflict-11.3 {
SELECT * FROM abc;
}
} {1 2 3 4 5 6 7 8 9}
-# Repeat test conflict-11.1 but this time commit.
+# Repeat test conflict2-11.1 but this time commit.
#
-do_test conflict-11.5 {
+do_test conflict2-11.5 {
execsql {
BEGIN;
-- Make sure the pager is in EXCLUSIVE state.
@@ -757,31 +763,32 @@ do_test conflict-11.5 {
SELECT * FROM abc;
}
} {1 2 3 7 8 9}
-integrity_check conflict-11.6
+integrity_check conflict2-11.6
# Make sure UPDATE OR REPLACE works on tables that have only
# an INTEGER PRIMARY KEY.
#
-do_test conflict-12.1 {
+do_test conflict2-12.1 {
execsql {
- CREATE TABLE t5(a INTEGER PRIMARY KEY, b text);
+ CREATE TABLE t5(a INTEGER PRIMARY KEY, b text) WITHOUT rowid;
INSERT INTO t5 VALUES(1,'one');
INSERT INTO t5 VALUES(2,'two');
SELECT * FROM t5
}
} {1 one 2 two}
-do_test conflict-12.2 {
+do_test conflict2-12.2 {
execsql {
UPDATE OR IGNORE t5 SET a=a+1 WHERE a=1;
SELECT * FROM t5;
}
} {1 one 2 two}
-do_test conflict-12.3 {
+do_test conflict2-12.3 {
catchsql {
UPDATE t5 SET a=a+1 WHERE a=1;
}
-} {1 {PRIMARY KEY must be unique}}
-do_test conflict-12.4 {
+} {1 {UNIQUE constraint failed: t5.a}}
+verify_ex_errcode conflict2-12.3b SQLITE_CONSTRAINT_PRIMARYKEY
+do_test conflict2-12.4 {
execsql {
UPDATE OR REPLACE t5 SET a=a+1 WHERE a=1;
SELECT * FROM t5;
@@ -792,17 +799,18 @@ do_test conflict-12.4 {
# Ticket [c38baa3d969eab7946dc50ba9d9b4f0057a19437]
# REPLACE works like ABORT on a CHECK constraint.
#
-do_test conflict-13.1 {
+do_test conflict2-13.1 {
execsql {
- CREATE TABLE t13(a CHECK(a!=2));
+ CREATE TABLE t13(a PRIMARY KEY CHECK(a!=2)) WITHOUT rowid;
BEGIN;
REPLACE INTO t13 VALUES(1);
}
catchsql {
REPLACE INTO t13 VALUES(2);
}
-} {1 {constraint failed}}
-do_test conflict-13.2 {
+} {1 {CHECK constraint failed: t13}}
+verify_ex_errcode conflict2-13.1b SQLITE_CONSTRAINT_CHECK
+do_test conflict2-13.2 {
execsql {
REPLACE INTO t13 VALUES(3);
COMMIT;
@@ -810,5 +818,38 @@ do_test conflict-13.2 {
}
} {1 3}
+# Test for an unreleased bug in the REPLACE conflict resolution
+# discovered on 2013-11-09.
+#
+do_execsql_test conflict2-14.1 {
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1(
+ x TEXT PRIMARY KEY NOT NULL,
+ y TEXT NOT NULL,
+ z INTEGER
+ );
+ INSERT INTO t1 VALUES('alpha','beta',1);
+ CREATE UNIQUE INDEX t1xy ON t1(x,y);
+ REPLACE INTO t1(x,y,z) VALUES('alpha','gamma',1);
+ PRAGMA integrity_check;
+ SELECT x,y FROM t1 INDEXED BY t1xy;
+ SELECT x,y,z FROM t1 NOT INDEXED;
+} {ok alpha gamma alpha gamma 1}
+do_execsql_test conflict2-14.2 {
+ DROP TABLE IF EXISTS t1;
+ CREATE TABLE t1(
+ x TEXT PRIMARY KEY NOT NULL,
+ y TEXT NOT NULL,
+ z INTEGER
+ ) WITHOUT ROWID;
+ INSERT INTO t1 VALUES('alpha','beta',1);
+ CREATE UNIQUE INDEX t1xy ON t1(x,y);
+ REPLACE INTO t1(x,y,z) VALUES('alpha','gamma',1);
+ PRAGMA integrity_check;
+ SELECT x,y FROM t1 INDEXED BY t1xy;
+ SELECT x,y,z FROM t1 NOT INDEXED;
+} {ok alpha gamma alpha gamma 1}
+
+
finish_test
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/test/conflict.test ('k') | third_party/sqlite/sqlite-src-3080704/test/conflict3.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698