]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Allow ROWID values in indexed vector comparisons.
authordrh <drh@noemail.net>
Fri, 26 Aug 2016 13:19:49 +0000 (13:19 +0000)
committerdrh <drh@noemail.net>
Fri, 26 Aug 2016 13:19:49 +0000 (13:19 +0000)
FossilOrigin-Name: b0cc6be4eb81f21b11796e1f14d4412bf21dea6e

manifest
manifest.uuid
src/expr.c
src/sqliteInt.h
src/where.c

index 0ab7cba6557db2f7a4849988277936c62583a930..1bca06079a1df658e1025c4b291b99bd34ba3d72 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Comment\simprovements.\s\sPut\sALWAYS\sand\sNEVER\smacros\son\sthree\sunreachable\nbranches.
-D 2016-08-26T03:42:57.323
+C Allow\sROWID\svalues\sin\sindexed\svector\scomparisons.
+D 2016-08-26T13:19:49.916
 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 5017381e4853b1472e01d5bb926be1268eba429c
@@ -338,7 +338,7 @@ F src/ctime.c e77f3dc297b4b65c96da78b4ae4272fdfae863d7
 F src/date.c 95c9a8d00767e7221a8e9a31f4e913fc8029bf6b
 F src/dbstat.c 19ee7a4e89979d4df8e44cfac7a8f905ec89b77d
 F src/delete.c 76c084f0265f4a3cd1ecf17eee112a94f1ccbc05
-F src/expr.c bca7140549a34c8a71a4cf0605666403af390477
+F src/expr.c 1f2ddbec8bf6de323cc0da3ff73e80b0ad21769d
 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb
 F src/fkey.c e2be0968c1adc679c87e467aa5b4f167588f38a8
 F src/func.c 29cc9acb170ec1387b9f63eb52cd85f8de96c771
@@ -390,7 +390,7 @@ F src/shell.c 79dda477be6c96eba6e952a934957ad36f87acc7
 F src/sqlite.h.in 4a030e254e204570444b34bf7d40fb4a5416089e
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
-F src/sqliteInt.h db8aa0c875b1a3cdb26e1cee47662c30a34882fd
+F src/sqliteInt.h c9e010a79ab4ed7bdc910a24d8f08f3c6d5f822c
 F src/sqliteLimit.h c0373387c287c8d0932510b5547ecde31b5da247
 F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
 F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
@@ -465,7 +465,7 @@ F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9
 F src/wal.c 02eeecc265f6ffd0597378f5d8ae9070b62a406a
 F src/wal.h 6dd221ed384afdc204bc61e25c23ef7fd5a511f2
 F src/walker.c 2d2cc7fb0f320f7f415215d7247f3c584141ac09
-F src/where.c 2f60a506364b22c48371b8b94089c4028a694a0a
+F src/where.c bad93f9bc5e62c38d2e0d2f572dd01d359c8d4cb
 F src/whereInt.h 14dd243e13b81cbb0a66063d38b70f93a7d6e613
 F src/wherecode.c 5a5528c39be09593cada6ae465d7a0f48db0077f
 F src/whereexpr.c 7f9ada866d48d15d09754ae819c1c40efe3b2aff
@@ -1521,7 +1521,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 9d96f61481704e5ec399ee425f0ebb246902ecc5
-R 0b547643c3844e6bc7fc81ff0189aeeb
+P 397617009e07004596476d6f5644fdf84c376f54
+R bebe23f740f385ed54a0790b48a77a67
 U drh
-Z e947ea7de839ffcabb8c6e9f9aa97cfb
+Z b30339a1eb9e7f2b74488db2fab0ab4b
index 559f8ba56e4a50bf7b1301c57b58f68b18cfa345..f2f928f54a561c0d908e43d46a2008ae03ecb331 100644 (file)
@@ -1 +1 @@
-397617009e07004596476d6f5644fdf84c376f54
\ No newline at end of file
+b0cc6be4eb81f21b11796e1f14d4412bf21dea6e
\ No newline at end of file
index f0670799e8044a5fba7d546436d0cf2a0f9ea9a0..a62538c556b7be7a949690975affc6b54b93ae48 100644 (file)
 static void exprCodeBetween(Parse*,Expr*,int,void(*)(Parse*,Expr*,int,int),int);
 static int exprCodeVector(Parse *pParse, Expr *p, int *piToFree);
 
+/*
+** Return the affinity character for a single column of a table.
+*/
+char sqlite3TableColumnAffinity(Table *pTab, int iCol){
+  assert( iCol<pTab->nCol );
+  return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER;
+}
 
 /*
 ** Return the 'affinity' of the expression pExpr if any.
@@ -52,11 +59,7 @@ char sqlite3ExprAffinity(Expr *pExpr){
   }
 #endif
   if( op==TK_AGG_COLUMN || op==TK_COLUMN ){
-    int j = pExpr->iColumn;
-    assert( pExpr->pTab!=0 );
-    if( j<0 ) return SQLITE_AFF_INTEGER;
-    assert( pExpr->pTab && j<pExpr->pTab->nCol );
-    return pExpr->pTab->aCol[j].affinity;
+    return sqlite3TableColumnAffinity(pExpr->pTab, pExpr->iColumn);
   }
   return pExpr->affinity;
 }
@@ -2173,7 +2176,7 @@ int sqlite3FindInIndex(
       for(i=0; i<nExpr && affinity_ok; i++){
         Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i);
         int iCol = pEList->a[i].pExpr->iColumn;
-        char idxaff = pTab->aCol[iCol].affinity;  /* RHS table affinity */
+        char idxaff = sqlite3TableColumnAffinity(pTab,iCol); /* RHS table */
         char cmpaff = sqlite3CompareAffinity(pLhs, idxaff);
         testcase( cmpaff==SQLITE_AFF_BLOB );
         testcase( cmpaff==SQLITE_AFF_TEXT );
@@ -2208,7 +2211,6 @@ int sqlite3FindInIndex(
           CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
           int j;
 
-          assert( pReq || pParse->nErr );
           if( pReq==0 ) break;
 
           for(j=0; j<nExpr; j++){
index d5ba007724e80044e494e591028c61e6a97f60c0..dbb18a745803b20986416b3ee6dbd3c1c9362f19 100644 (file)
@@ -3883,6 +3883,7 @@ const char *sqlite3IndexAffinityStr(sqlite3*, Index*);
 void sqlite3TableAffinity(Vdbe*, Table*, int);
 char sqlite3CompareAffinity(Expr *pExpr, char aff2);
 int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity);
+char sqlite3TableColumnAffinity(Table*,int);
 char sqlite3ExprAffinity(Expr *pExpr);
 int sqlite3Atoi64(const char*, i64*, int, u8);
 int sqlite3DecOrHexToI64(const char*, i64*);
index 74da4089a883b6c60f74cf01fb3f2f931afc6b87..5c004ca0c2b430045a00d3699bca22fb88b1ba2f 100644 (file)
@@ -2261,11 +2261,11 @@ int whereRangeVectorLen(
     }
 
     aff = sqlite3CompareAffinity(pRhs, sqlite3ExprAffinity(pLhs));
-    idxaff = pIdx->pTable->aCol[pLhs->iColumn].affinity;
+    idxaff = sqlite3TableColumnAffinity(pIdx->pTable, pLhs->iColumn);
     if( aff!=idxaff ) break;
 
     pColl = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs);
-    if( NEVER(pColl==0) ) break;
+    if( pColl==0 ) break;
     if( sqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break;
   }
   return i;