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

Unified Diff: third_party/sqlite/src/test/without_rowid1.test

Issue 1610963002: Import SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « third_party/sqlite/src/test/with3.test ('k') | third_party/sqlite/src/test/without_rowid3.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/without_rowid1.test
diff --git a/third_party/sqlite/src/test/without_rowid1.test b/third_party/sqlite/src/test/without_rowid1.test
index 9d7a6430fe3b4b30ce6b9e798fea9913c0faac93..0c77773abb3e7812fb19c5f8ff76c8a91c835f6b 100644
--- a/third_party/sqlite/src/test/without_rowid1.test
+++ b/third_party/sqlite/src/test/without_rowid1.test
@@ -277,5 +277,56 @@ foreach {tn cnt where eqp} $queries {
do_eqp_test 5.7.$tn.2 "SELECT count(*) FROM t46 WHERE $where" $eqp
}
+#-------------------------------------------------------------------------
+# Check that redundant UNIQUE constraints do not cause a problem.
+#
+do_execsql_test 6.0 {
+ CREATE TABLE t47(a, b UNIQUE PRIMARY KEY) WITHOUT ROWID;
+ CREATE INDEX i47 ON t47(a);
+ INSERT INTO t47 VALUES(1, 2);
+ INSERT INTO t47 VALUES(2, 4);
+ INSERT INTO t47 VALUES(3, 6);
+ INSERT INTO t47 VALUES(4, 8);
+
+ VACUUM;
+ PRAGMA integrity_check;
+ SELECT name FROM sqlite_master WHERE tbl_name = 't47';
+} {ok t47 i47}
+
+do_execsql_test 6.1 {
+ CREATE TABLE t48(
+ a UNIQUE UNIQUE,
+ b UNIQUE,
+ PRIMARY KEY(a),
+ UNIQUE(a)
+ ) WITHOUT ROWID;
+ INSERT INTO t48 VALUES('a', 'b'), ('c', 'd'), ('e', 'f');
+ VACUUM;
+ PRAGMA integrity_check;
+ SELECT name FROM sqlite_master WHERE tbl_name = 't48';
+} {
+ ok t48 sqlite_autoindex_t48_2
+}
+
+# 2015-05-28: CHECK constraints can refer to the rowid in a
+# rowid table, but not in a WITHOUT ROWID table.
+#
+do_execsql_test 7.1 {
+ CREATE TABLE t70a(
+ a INT CHECK( rowid!=33 ),
+ b TEXT PRIMARY KEY
+ );
+ INSERT INTO t70a(a,b) VALUES(99,'hello');
+} {}
+do_catchsql_test 7.2 {
+ INSERT INTO t70a(rowid,a,b) VALUES(33,99,'xyzzy');
+} {1 {CHECK constraint failed: t70a}}
+do_catchsql_test 7.3 {
+ CREATE TABLE t70b(
+ a INT CHECK( rowid!=33 ),
+ b TEXT PRIMARY KEY
+ ) WITHOUT ROWID;
+} {1 {no such column: rowid}}
+
finish_test
« no previous file with comments | « third_party/sqlite/src/test/with3.test ('k') | third_party/sqlite/src/test/without_rowid3.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698