1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Improve the error messages generated by the rtree module when a constraint fails.

FossilOrigin-Name: 3ad2531efb64b7c53b777ddf3681203217052b32
This commit is contained in:
dan
2016-05-23 16:16:13 +00:00
parent c173ad8011
commit 5782bc27fa
5 changed files with 101 additions and 23 deletions

View File

@ -47,7 +47,8 @@ ifcapable !rtree {
#
# rtree3-8: Test OOM while registering the r-tree module with sqlite.
#
# rtree3-11: OOM following a constraint failure
#
do_faultsim_test rtree3-1 -faults oom* -prep {
faultsim_delete_and_reopen
} -body {
@ -234,4 +235,32 @@ do_faultsim_test rtree3-10 -faults oom-* -prep {
faultsim_test_result {0 2}
}
do_test rtree3-11.prep {
faultsim_delete_and_reopen
execsql {
CREATE VIRTUAL TABLE rt USING rtree(ii, x1, x2, y1, y2);
INSERT INTO rt VALUES(1, 2, 3, 4, 5);
}
faultsim_save_and_close
} {}
do_faultsim_test rtree3-10.1 -faults oom-* -prep {
faultsim_restore_and_reopen
execsql { SELECT * FROM rt }
} -body {
execsql { INSERT INTO rt VALUES(1, 2, 3, 4, 5) }
} -test {
faultsim_test_result {1 {UNIQUE constraint failed: rt.ii}} \
{1 {constraint failed}}
}
do_faultsim_test rtree3-10.2 -faults oom-* -prep {
faultsim_restore_and_reopen
execsql { SELECT * FROM rt }
} -body {
execsql { INSERT INTO rt VALUES(2, 2, 3, 5, 4) }
} -test {
faultsim_test_result {1 {rtree constraint failed: rt.(y1<=y2)}} \
{1 {constraint failed}}
}
finish_test