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:
@ -49,6 +49,31 @@ do_execsql_test 1.2 {
|
|||||||
PRAGMA integrity_check;
|
PRAGMA integrity_check;
|
||||||
} {ok}
|
} {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
|
finish_test
|
||||||
|
@ -98,7 +98,12 @@
|
|||||||
** update, the corresponding data_% table should contain a single record
|
** update, the corresponding data_% table should contain a single record
|
||||||
** with the "ota_control" column set to contain integer value 0. The
|
** 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
|
** 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
|
** For each row to DELETE from the target database as part of the OTA
|
||||||
** update, the corresponding data_% table should contain a single record
|
** update, the corresponding data_% table should contain a single record
|
||||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
|||||||
C Add\sOP_Affinity\sopcodes\sto\sthe\sVMs\sgenerated\sby\ssqlite3_index_writer().
|
C Have\sthe\ssqlite3_index_writer()\sVMs\scheck\sthat\sthe\sfinal\svalues\sof\srecords\sinserted\sinto\sindexes\son\srowid\stables\sare\sintegers.
|
||||||
D 2014-09-15T10:44:24.271
|
D 2014-09-15T12:18:29.913
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@ -124,9 +124,9 @@ F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
|
|||||||
F ext/ota/ota.c d37097e92a005d3915883adefbb93019ea6f8841
|
F ext/ota/ota.c d37097e92a005d3915883adefbb93019ea6f8841
|
||||||
F ext/ota/ota1.test fe0bb8acf0caef6c19937b84c6547b788342610d
|
F ext/ota/ota1.test fe0bb8acf0caef6c19937b84c6547b788342610d
|
||||||
F ext/ota/ota2.test 13f76922446c62ed96192e938b8e625ebf0142fa
|
F ext/ota/ota2.test 13f76922446c62ed96192e938b8e625ebf0142fa
|
||||||
F ext/ota/ota3.test 9e3e42c6083e92909c408f1fe62aa07b0c9f905c
|
F ext/ota/ota3.test 7179a90eb64cf8135a6885568653f158fb130872
|
||||||
F ext/ota/sqlite3ota.c 3697f6db2d51d5f7c0f0306fe94514785361e521
|
F ext/ota/sqlite3ota.c 3697f6db2d51d5f7c0f0306fe94514785361e521
|
||||||
F ext/ota/sqlite3ota.h 545f0008b5f02f2595899cb9841caddada5c17c0
|
F ext/ota/sqlite3ota.h 39ce4dffbfcf4ade9e4526369fe2243709345c8e
|
||||||
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761
|
||||||
F ext/rtree/rtree.c 57bec53e1a677ab74217fe1f20a58c3a47261d6b
|
F ext/rtree/rtree.c 57bec53e1a677ab74217fe1f20a58c3a47261d6b
|
||||||
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e
|
||||||
@ -296,7 +296,7 @@ F src/vdbe.h c63fad052c9e7388d551e556e119c0bcf6bebdf8
|
|||||||
F src/vdbeInt.h cdc8e421f85beb1ac9b4669ec5beadab6faa15e0
|
F src/vdbeInt.h cdc8e421f85beb1ac9b4669ec5beadab6faa15e0
|
||||||
F src/vdbeapi.c 09677a53dd8c71bcd670b0bd073bb9aefa02b441
|
F src/vdbeapi.c 09677a53dd8c71bcd670b0bd073bb9aefa02b441
|
||||||
F src/vdbeaux.c cef5d34a64ae3a65b56d96d3fd663246ec8e1c36
|
F src/vdbeaux.c cef5d34a64ae3a65b56d96d3fd663246ec8e1c36
|
||||||
F src/vdbeblob.c 7a28ade0cae13bd99f5c4c8f008f68e942c23115
|
F src/vdbeblob.c 7ddae314db27c39f654fd2af577c9afc33d089d9
|
||||||
F src/vdbemem.c 921d5468a68ac06f369810992e84ca22cc730a62
|
F src/vdbemem.c 921d5468a68ac06f369810992e84ca22cc730a62
|
||||||
F src/vdbesort.c 7c45bfcd823f30d172bbbc1b9f51ef4402fbfe8d
|
F src/vdbesort.c 7c45bfcd823f30d172bbbc1b9f51ef4402fbfe8d
|
||||||
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
|
F src/vdbetrace.c 6f52bc0c51e144b7efdcfb2a8f771167a8816767
|
||||||
@ -1199,7 +1199,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
|
||||||
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
|
||||||
P e109b27e4d66b83e1a804e7556d9c91aa37fea28
|
P b9b38cb8e21826ddfb4c87a1f166ad33c3c7b6eb
|
||||||
R 75f9e5319b2343a328ed4364426b7add
|
R 6282c8b629d24290f7b2f44befcb6a71
|
||||||
U dan
|
U dan
|
||||||
Z c56c0b8cb355334f7ef68c91cc8c371e
|
Z 32d433205c33319cd81cbc2b152b81af
|
||||||
|
@ -1 +1 @@
|
|||||||
b9b38cb8e21826ddfb4c87a1f166ad33c3c7b6eb
|
cca376bff3510dc5e99fc5824862c3471ceced16
|
@ -549,6 +549,11 @@ int sqlite3_index_writer(
|
|||||||
}
|
}
|
||||||
regRec = ++pParse->nMem;
|
regRec = ++pParse->nMem;
|
||||||
|
|
||||||
|
/* If this is a rowid table, check that the rowid field is an integer. */
|
||||||
|
if( HasRowid(pTab) ){
|
||||||
|
sqlite3VdbeAddOp2(v, OP_MustBeInt, pIdx->nColumn, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if( bDelete==0 ){
|
if( bDelete==0 ){
|
||||||
sqlite3VdbeAddOp4(v, OP_MakeRecord, 1, pIdx->nColumn, regRec, zAffinity, 0);
|
sqlite3VdbeAddOp4(v, OP_MakeRecord, 1, pIdx->nColumn, regRec, zAffinity, 0);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user