]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Use the new SQLITE_IDXTYPE_IPK values (3) on Index.idxType to indicate the
authordrh <drh@noemail.net>
Thu, 10 Jan 2019 13:56:08 +0000 (13:56 +0000)
committerdrh <drh@noemail.net>
Thu, 10 Jan 2019 13:56:08 +0000 (13:56 +0000)
fake INTEGER PRIMARY KEY index used during query planning.

FossilOrigin-Name: e22d2f905fe840bea51b536ebedc9b637190ea0a37f16559668d99a61e971411

manifest
manifest.uuid
src/sqliteInt.h
src/where.c
test/fts3fuzz001.test

index 67428b3e6c63ea17d80b33e9a79e429fd135271b..5fb74c2faa2c62e1f7acc2d8cde167a1dfe9f638 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\sfts3DecodeIntArray()\sfunction\sso\sthat\sit\swill\snot\sread\soff\sthe\send\nof\sthe\sbuffer\sit\sis\shanded.\s\sAny\sunread\sintegers\sare\sset\sto\szero.
-D 2019-01-10T01:12:43.917
+C Use\sthe\snew\sSQLITE_IDXTYPE_IPK\svalues\s(3)\son\sIndex.idxType\sto\sindicate\sthe\nfake\sINTEGER\sPRIMARY\sKEY\sindex\sused\sduring\squery\splanning.
+D 2019-01-10T13:56:08.124
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F Makefile.in d8b254f8bb81bab43c340d70d17dc3babab40fcc8a348c8255881f780a45fee6
@@ -517,7 +517,7 @@ F src/shell.c.in 0722a9e3a1b23674f07c194b8f71c953c775bad280e7f179a32bf72cd009b56
 F src/sqlite.h.in b54cd42d2f3b739a00de540cafe2dcd0de3b8e1748a2db33a68def487e9e602f
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 960f1b86c3610fa23cb6a267572a97dcf286e77aa0dd3b9b23292ffaa1ea8683
-F src/sqliteInt.h 57f7bfa8a64e6f37e256ab4137e22cd74b9cde1e8669d44bba46c13105b4d27e
+F src/sqliteInt.h 829bebd46e570fc1a22923df111417145b394b9c198a9c68c2d7b9a4243b9c29
 F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
 F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e
 F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
@@ -597,7 +597,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
 F src/wal.c 3f4f653daf234fe713edbcbca3fec2350417d159d28801feabc702a22c4e213f
 F src/wal.h 606292549f5a7be50b6227bd685fa76e3a4affad71bb8ac5ce4cb5c79f6a176a
 F src/walker.c fb94aadc9099ff9c6506d0a8b88d51266005bcaa265403f3d7caf732a562eb66
-F src/where.c 981412c27abb9378d3024eae6f3040abd3c16db722f5ef8a7d613141ea2aea78
+F src/where.c 7a1db797b6576d66424845666b122f8bc3eda0f2eb8b21518baf40407bbdf6ac
 F src/whereInt.h 5f14db426ca46a83eabab1ae9aa6d4b8f27504ad35b64c290916289b1ddb2e88
 F src/wherecode.c 89d2ec668aec884dfa7ac500c6744e42ec0590fcd72fb740a8b48326a8412811
 F src/whereexpr.c 36b47f7261d6b6f1a72d774c113b74beddf6745aba1018e64b196e29db233442
@@ -930,7 +930,7 @@ F test/fts3expr5.test f9abfffbf5e53d48a33e12a1e8f8ba2c551c9b49
 F test/fts3fault.test 9fb7d6266a38806de841f7244bac1b0fe3a1477184bbb10b172d19d2ca6ad692
 F test/fts3fault2.test 6a17a11d8034b1c4eca9f3091649273d56c49ff049e2173df8060f94341e9da0
 F test/fts3first.test dbdedd20914c8d539aa3206c9b34a23775644641
-F test/fts3fuzz001.test dea922cb318324baa0f5092c64c5f677a63e446924cce00a36289455f8b1fa18
+F test/fts3fuzz001.test 5069b96ca71cc44a223c75725c088e9b6fb3286967048f57063244b53b4d4380
 F test/fts3join.test 949b4f5ae3ae9cc2423cb865d711e32476bdb205ab2be923fdf48246e4a44166
 F test/fts3malloc.test b0e4c133b8d61d4f6d112d8110f8320e9e453ef6
 F test/fts3matchinfo.test aa66cc50615578b30f6df9984819ae5b702511cf8a94251ec7c594096a703a4a
@@ -1797,7 +1797,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 931278b257b12ac14fc8fbc82c6dc88ce4ac4b8e0d668543e68f0289d825daa1
-R e543c7822807d0414916bad4b832fc3e
+P 666cf8f6b39ae1f72e82b45e9cacba23caf61370ca0c695b3b14452accbb1a0d
+R b4a33c44b98098920d5ea67635d615ee
 U drh
-Z dca4f26f9f844ed901c4c2b939969898
+Z 91befd19851fb8d3389285e1801b2392
index 59c0dc269563f0a56badce7cb5383f334019ce8c..87284cc96a586dd4523a2c799e692a0366c505f2 100644 (file)
@@ -1 +1 @@
-666cf8f6b39ae1f72e82b45e9cacba23caf61370ca0c695b3b14452accbb1a0d
\ No newline at end of file
+e22d2f905fe840bea51b536ebedc9b637190ea0a37f16559668d99a61e971411
\ No newline at end of file
index 9bc8160db971582cbb4d4e86a9e31aff6df9aec6..d701e3fe3e5ae5b8e64883510964acca708e414b 100644 (file)
@@ -2243,7 +2243,7 @@ struct Index {
   u16 nKeyCol;             /* Number of columns forming the key */
   u16 nColumn;             /* Number of columns stored in the index */
   u8 onError;              /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
-  unsigned idxType:2;      /* 1==UNIQUE, 2==PRIMARY KEY, 0==CREATE INDEX */
+  unsigned idxType:2;      /* 0:Normal 1:UNIQUE, 2:PRIMARY KEY, 3:IPK */
   unsigned bUnordered:1;   /* Use this index for == or IN queries only */
   unsigned uniqNotNull:1;  /* True if UNIQUE and NOT NULL for all columns */
   unsigned isResized:1;    /* True if resizeIndexObject() has been called */
@@ -2268,6 +2268,7 @@ struct Index {
 #define SQLITE_IDXTYPE_APPDEF      0   /* Created using CREATE INDEX */
 #define SQLITE_IDXTYPE_UNIQUE      1   /* Implements a UNIQUE constraint */
 #define SQLITE_IDXTYPE_PRIMARYKEY  2   /* Is the PRIMARY KEY for the table */
+#define SQLITE_IDXTYPE_IPK         3   /* INTEGER PRIMARY KEY index */
 
 /* Return true if index X is a PRIMARY KEY index */
 #define IsPrimaryKeyIndex(X)  ((X)->idxType==SQLITE_IDXTYPE_PRIMARYKEY)
index 9c0192747263e622ea52fe3335fbf27b4f03391e..be86816af29b63e06e6548dbe3f10ee74228131e 100644 (file)
@@ -2210,7 +2210,7 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
   rc = whereLoopXfer(db, p, pTemplate);
   if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){
     Index *pIndex = p->u.btree.pIndex;
-    if( pIndex && pIndex->tnum==0 ){
+    if( pIndex && pIndex->idxType==SQLITE_IDXTYPE_IPK ){
       p->u.btree.pIndex = 0;
     }
   }
@@ -2377,8 +2377,8 @@ static int whereRangeVectorLen(
 ** terms only. If it is modified, this value is restored before this 
 ** function returns.
 **
-** If pProbe->tnum==0, that means pIndex is a fake index used for the
-** INTEGER PRIMARY KEY.
+** If pProbe->idxType==SQLITE_IDXTYPE_IPK, that means pIndex is 
+** a fake index used for the INTEGER PRIMARY KEY.
 */
 static int whereLoopAddBtreeIndex(
   WhereLoopBuilder *pBuilder,     /* The WhereLoop factory */
@@ -2878,6 +2878,7 @@ static int whereLoopAddBtree(
     sPk.onError = OE_Replace;
     sPk.pTable = pTab;
     sPk.szIdxRow = pTab->szTabRow;
+    sPk.idxType = SQLITE_IDXTYPE_IPK;
     aiRowEstPk[0] = pTab->nRowLogEst;
     aiRowEstPk[1] = 0;
     pFirst = pSrc->pTab->pIndex;
@@ -2968,7 +2969,7 @@ static int whereLoopAddBtree(
     b = indexMightHelpWithOrderBy(pBuilder, pProbe, pSrc->iCursor);
     /* The ONEPASS_DESIRED flags never occurs together with ORDER BY */
     assert( (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 || b==0 );
-    if( pProbe->tnum<=0 ){
+    if( pProbe->idxType==SQLITE_IDXTYPE_IPK ){
       /* Integer primary key index */
       pNew->wsFlags = WHERE_IPK;
 
index 2f144ab4bafbb4c075dacb85c01aad48b2dbdedd..aa85eb72ca49e0abae34cee8d03db1218510647b 100644 (file)
@@ -102,7 +102,7 @@ do_test fts3fuzz001-120 {
   catchsql {
     INSERT INTO t1(t1) VALUES('optimize');
   }
-} {0 {}}
+} {1 {database disk image is malformed}}
 do_test fts3fuzz001-121 {
   catchsql {
     INSERT INTO t1(t1) VALUES('integrity-check');