mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix PRAGMA integrity_check so that it works with a UNIQUE index over
expressions. FossilOrigin-Name: 113181cec4db418b07640d6b1967923992efd71a
This commit is contained in:
@ -210,7 +210,8 @@ do_execsql_test indexexpr1-400 {
|
||||
SELECT x, printf('ab%04xyz',x), random() FROM c;
|
||||
CREATE UNIQUE INDEX t3abc ON t3(CAST(a AS text), b, substr(c,1,3));
|
||||
SELECT a FROM t3 WHERE CAST(a AS text)<='10' ORDER BY +a;
|
||||
} {1 10}
|
||||
PRAGMA integrity_check;
|
||||
} {1 10 ok}
|
||||
do_catchsql_test indexexpr1-410 {
|
||||
INSERT INTO t3 SELECT * FROM t3 WHERE rowid=10;
|
||||
} {1 {UNIQUE constraint failed: index 't3abc'}}
|
||||
@ -290,6 +291,21 @@ do_catchsql_test indexexpr1-820 {
|
||||
INSERT INTO t8(a,b) VALUES(4,'BARTHMERE');
|
||||
} {0 {}}
|
||||
|
||||
# Check that PRAGMA integrity_check works correctly on a
|
||||
# UNIQUE index that includes rowid and expression terms.
|
||||
#
|
||||
do_execsql_test indexexpr1-900 {
|
||||
CREATE TABLE t9(a,b,c,d);
|
||||
CREATE UNIQUE INDEX t9x1 ON t9(c,abs(d),b);
|
||||
INSERT INTO t9(rowid,a,b,c,d) VALUES(1,2,3,4,5);
|
||||
INSERT INTO t9(rowid,a,b,c,d) VALUES(2,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO t9(rowid,a,b,c,d) VALUES(3,NULL,NULL,NULL,NULL);
|
||||
INSERT INTO t9(rowid,a,b,c,d) VALUES(4,5,6,7,8);
|
||||
PRAGMA integrity_check;
|
||||
} {ok}
|
||||
do_catchsql_test indexexpr1-910 {
|
||||
INSERT INTO t9(a,b,c,d) VALUES(5,6,7,-8);
|
||||
} {1 {UNIQUE constraint failed: index 't9x1'}}
|
||||
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user