aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authordrh <>2025-02-21 17:03:22 +0000
committerdrh <>2025-02-21 17:03:22 +0000
commitce25007db8df01e3271486574d520d4dea4cf97a (patch)
treeba6a3d33af56c5a0d13d80ab8eb7447e69319ce6 /test
parent220260b8965eb264cab8cb5ee42baacb08ef1eb4 (diff)
downloadsqlite-ce25007db8df01e3271486574d520d4dea4cf97a.tar.gz
sqlite-ce25007db8df01e3271486574d520d4dea4cf97a.zip
Detect when a UNIQUE or PRIMARY KEY on a WITHOUT ROWID table would need
to use more than SQLITE_LIMIT_COLUMN columns and raise an error. Also include some unrelated compiler warning fixes. FossilOrigin-Name: d7729dbbf231d57cbcaaa5004d0a9c4957f112dd6520052995b232aa521c0ca3
Diffstat (limited to 'test')
-rw-r--r--test/without_rowid1.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/without_rowid1.test b/test/without_rowid1.test
index 3c33f733a..0095fab0c 100644
--- a/test/without_rowid1.test
+++ b/test/without_rowid1.test
@@ -487,4 +487,24 @@ ifcapable altertable {
SELECT name FROM sqlite_sequence ORDER BY +name;
} {a c0 c2}
}
+
+# Ensure that the number of columns in an index on a WITHOUT ROWID
+# table does not exceed SQLITE_LIMIT_COLUMN.
+#
+reset_db
+sqlite3_limit db SQLITE_LIMIT_COLUMN 8
+do_catchsql_test 16.1 {
+ CREATE TABLE t1(
+ c1,c2,c3,c4,c5,c6,c7,c8,
+ PRIMARY KEY(c1,c2,c1 COLLATE NOCASE)
+ ) WITHOUT ROWID;
+} {1 {too many columns on sqlite_autoindex_t1_1}}
+do_catchsql_test 16.2 {
+ CREATE TABLE t1(
+ c1,c2,c3,c4,c5,c6,c7,c8,
+ PRIMARY KEY(c1,c2),
+ UNIQUE(c3,c4,c5,c6,c7,c8,c3 COLLATE nocase)
+ ) WITHOUT ROWID;
+} {1 {too many columns on sqlite_autoindex_t1_2}}
+
finish_test