From 9ebfed294ee0a85b2f97f4a8a70a46bfc5eb749f Mon Sep 17 00:00:00 2001 From: rajajisai Date: Tue, 5 Aug 2025 21:18:52 -0700 Subject: [PATCH] Including tests --- testing/drop_index.test | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/testing/drop_index.test b/testing/drop_index.test index 4edbfc2bc..7ddc21a45 100755 --- a/testing/drop_index.test +++ b/testing/drop_index.test @@ -44,3 +44,15 @@ do_execsql_test_on_specific_db {:memory:} drop-index-after-ops-1 { DROP INDEX t_idx6; SELECT count(*) FROM sqlite_schema WHERE type='index' AND name='t_idx6'; } {0} + +# Test dropping of indices associated with unique or primary contraint indices produces an error +do_execsql_test_in_memory_error_content drop-index-primary-key-index { + CREATE TABLE t15a (id TEXT PRIMARY KEY ); + DROP INDEX sqlite_autoindex_t15a_1; +} {"index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped"} + + +do_execsql_test_in_memory_error_content drop-index-unique-index { + CREATE TABLE t15b (id INT UNIQUE ); + DROP INDEX sqlite_autoindex_t15b_1; +} {"index associated with UNIQUE or PRIMARY KEY constraint cannot be dropped"} \ No newline at end of file