STRICT tables require all fields of the PRIMARY KEY to be NOT NULL.
FossilOrigin-Name: 5efdf9acad9d54783f5134b7e9338f44336862d87dc324d315b8d55e44df1923
This commit is contained in:
parent
3b7a0ccd5c
commit
ab16578b72
14
manifest
14
manifest
@ -1,5 +1,5 @@
|
||||
C Merge\sthe\sWITHOUT\sROWID,\sNOT\sNULL\sON\sCONFLICT\sbug\sfix\sinto\sthe\sstrict-tables\nbranch.
|
||||
D 2021-08-18T23:00:43.920
|
||||
C STRICT\stables\srequire\sall\sfields\sof\sthe\sPRIMARY\sKEY\sto\sbe\sNOT\sNULL.
|
||||
D 2021-08-19T00:24:43.029
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -488,7 +488,7 @@ F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6
|
||||
F src/btree.c e204a9c8fb4fe5dbb910a863ba487f4af9b5c501254ec4ccbfcdd6b1f65b7fb4
|
||||
F src/btree.h 74d64b8f28cfa4a894d14d4ed64fa432cd697b98b61708d4351482ae15913e22
|
||||
F src/btreeInt.h 7bc15a24a02662409ebcd6aeaa1065522d14b7fda71573a2b0568b458f514ae0
|
||||
F src/build.c 25adabcbe538ce25c577c3f6815c0a83c483a700984d784a69ed6883cbbd7a98
|
||||
F src/build.c c55bec6a37b3b521c10ac6ae2f73328e3a49c12a1b8c87ca151d81c5e1095142
|
||||
F src/callback.c d0b853dd413255d2e337b34545e54d888ea02f20da5ad0e63585b389624c4a6c
|
||||
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
|
||||
F src/ctime.c 8159d5f706551861c18ec6c8f6bdf105e15ea00367f05d9ab65d31a1077facc1
|
||||
@ -1425,7 +1425,7 @@ F test/stat.test 15a3106eddedfc882f64bc09f237b4169be4b92dd57c93031b8ff8b13af3e7c
|
||||
F test/statfault.test f525a7bf633e50afd027700e9a486090684b1ac1
|
||||
F test/stmt.test 54ed2cc0764bf3e48a058331813c3dbd19fc1d0827c3d8369914a5d8f564ec75
|
||||
F test/stmtvtab1.test 6873dfb24f8e79cbb5b799b95c2e4349060eb7a3b811982749a84b359468e2d5
|
||||
F test/strict1.test 36a24e127e2cdc65ecf23d03c9a4fbe6d8f7cb80f4c4bf09eb220c1ce4c84daf
|
||||
F test/strict1.test dab7a84f5445e696beb3e2eedda9b3a28fb16bf3092be1917b3f1a6163916197
|
||||
F test/subjournal.test 8d4e2572c0ee9a15549f0d8e40863161295107e52f07a3e8012a2e1fdd093c49
|
||||
F test/subquery.test d7268d193dd33d5505df965399d3a594e76ae13f
|
||||
F test/subquery2.test 90cf944b9de8204569cf656028391e4af1ccc8c0cc02d4ef38ee3be8de1ffb12
|
||||
@ -1921,7 +1921,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P a19305e5cfedf5c472200d6e05c1396443e348f052a40a0979f860f2ff06851d 13abba0941a724eb62455650976b03678e4455b6b3090c84a2ab2f4a7656b4d8
|
||||
R fda99db412e4d20b77fa444be1944106
|
||||
P 7ee01ee47da247a80bcf16f88eb187b8c0928024536435ed20797a1a90495511
|
||||
R 9431b5ba9e76c466e3043738fddec247
|
||||
U drh
|
||||
Z 59e849481af66370dc20d95e87531af1
|
||||
Z 0e5e6ca613f5601fc51663462528d032
|
||||
|
@ -1 +1 @@
|
||||
7ee01ee47da247a80bcf16f88eb187b8c0928024536435ed20797a1a90495511
|
||||
5efdf9acad9d54783f5134b7e9338f44336862d87dc324d315b8d55e44df1923
|
14
src/build.c
14
src/build.c
@ -2597,13 +2597,23 @@ void sqlite3EndTable(
|
||||
int ii;
|
||||
p->tabFlags |= TF_Strict;
|
||||
for(ii=0; ii<p->nCol; ii++){
|
||||
if( p->aCol[ii].eCType==COLTYPE_CUSTOM ){
|
||||
Column *pCol = &p->aCol[ii];
|
||||
if( pCol->eCType==COLTYPE_CUSTOM ){
|
||||
sqlite3ErrorMsg(pParse,
|
||||
"unknown datatype for %s.%s: \"%s\"",
|
||||
p->zName, p->aCol[ii].zCnName, sqlite3ColumnType(p->aCol+ii, "")
|
||||
p->zName, pCol->zCnName, sqlite3ColumnType(pCol, "")
|
||||
);
|
||||
return;
|
||||
}
|
||||
if( (pCol->colFlags & COLFLAG_PRIMKEY)!=0
|
||||
&& p->iPKey!=ii
|
||||
&& pCol->notNull == OE_None
|
||||
){
|
||||
/* Primary key columns other than the IPK may not be NULL
|
||||
** in strict mode */
|
||||
pCol->notNull = OE_Abort;
|
||||
p->tabFlags |= TF_HasNotNull;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,4 +89,25 @@ do_catchsql_test strict1-4.2 {
|
||||
INSERT INTO t1(c) VALUES('456');
|
||||
} {1 {t1.c holds only BLOB values}}
|
||||
|
||||
do_execsql_test strict1-5.1 {
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1(d) VALUES('xyz'),(4),(5.5),(NULL);
|
||||
SELECT typeof(d), d FROM t1;
|
||||
} {text xyz text 4 text 5.5 null {}}
|
||||
do_catchsql_test strict1-5.2 {
|
||||
INSERT INTO t1(d) VALUES(x'4567');
|
||||
} {1 {t1.d holds only TEXT values}}
|
||||
|
||||
do_execsql_test strict1-6.1 {
|
||||
DELETE FROM t1;
|
||||
INSERT INTO t1(e) VALUES(1),(2.5),('3'),('4.5'),(6.0),(NULL);
|
||||
SELECT typeof(e), e FROM t1;
|
||||
} {real 1.0 real 2.5 real 3.0 real 4.5 real 6.0 null {}}
|
||||
do_catchsql_test strict1-6.2 {
|
||||
INSERT INTO t1(e) VALUES('xyz');
|
||||
} {1 {t1.e holds only REAL values}}
|
||||
do_catchsql_test strict1-6.3 {
|
||||
INSERT INTO t1(e) VALUES(x'3456');
|
||||
} {1 {t1.e holds only REAL values}}
|
||||
|
||||
finish_test
|
||||
|
Loading…
Reference in New Issue
Block a user