1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Have the sqlite3_index_writer() VMs check that the final values of records inserted into indexes on rowid tables are integers.

FossilOrigin-Name: cca376bff3510dc5e99fc5824862c3471ceced16
This commit is contained in:
dan
2014-09-15 12:18:29 +00:00
parent d54e06ca5e
commit 13ce7931f7
5 changed files with 45 additions and 10 deletions

View File

@ -49,6 +49,31 @@ do_execsql_test 1.2 {
PRAGMA integrity_check;
} {ok}
#--------------------------------------------------------------------
# Test that NULL values may not be inserted into INTEGER PRIMARY KEY
# columns.
#
forcedelete ota.db
reset_db
do_execsql_test 2.0 {
CREATE TABLE x1(a INTEGER PRIMARY KEY, b TEXT, c REAL);
CREATE INDEX i1 ON x1(b, c);
} {}
do_test 2.1 {
sqlite3 db2 ota.db
db2 eval {
CREATE TABLE data_x1(a, b, c, ota_control);
INSERT INTO data_x1 VALUES(NULL, 'a', 'b', 0);
}
db2 close
list [catch { run_ota test.db ota.db } msg] $msg
} {1 {SQLITE_MISMATCH - datatype mismatch}}
do_execsql_test 2.2 {
PRAGMA integrity_check;
} {ok}
finish_test

View File

@ -98,7 +98,12 @@
** update, the corresponding data_% table should contain a single record
** with the "ota_control" column set to contain integer value 0. The
** other columns should be set to the values that make up the new record
** to insert.
** to insert.
**
** If the target database table has an INTEGER PRIMARY KEY and there are
** one or more auxiliary indexes, it is not possible to insert a NULL value
** into the IPK column. Attempting to do so results in an SQLITE_MISMATCH
** error.
**
** For each row to DELETE from the target database as part of the OTA
** update, the corresponding data_% table should contain a single record