]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
The NGQP might not find a solution if INDEXED BY constraints on the query
authordrh <drh@noemail.net>
Fri, 31 May 2013 20:43:57 +0000 (20:43 +0000)
committerdrh <drh@noemail.net>
Fri, 31 May 2013 20:43:57 +0000 (20:43 +0000)
are set wrong.  If that is the case, print a "no query solution" error
and abort before trying to use the non-existant solution.

FossilOrigin-Name: 42511a7e12a70cf3436d25e4d069e5d309dfd678

manifest
manifest.uuid
src/where.c

index 5aec48fb0eb540b531d6a9ad22d823fcbf9011a8..e85a435ce49eb08f91dd94fed14e6bb2cded747f 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Do\snot\ssearch\susing\sON\sclause\sconstraints\sof\sLEFT\sJOINs\sto\sthe\sright\sof\nthe\stable.
-D 2013-05-31T20:28:28.662
+C The\sNGQP\smight\snot\sfind\sa\ssolution\sif\sINDEXED\sBY\sconstraints\son\sthe\squery\nare\sset\swrong.\s\sIf\sthat\sis\sthe\scase,\sprint\sa\s"no\squery\ssolution"\serror\nand\sabort\sbefore\strying\sto\suse\sthe\snon-existant\ssolution.
+D 2013-05-31T20:43:57.656
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -289,7 +289,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
 F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d
 F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
 F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
-F src/where.c 3e4ca21a9b34ab25b2ec13704e8659581d57878d
+F src/where.c 7c931bf930fcf77d9a446e6d60692ab7a6251d00
 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
 F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
@@ -1093,7 +1093,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
 F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P 433d1aecd399590b767ebf07b32023fb718a6574
-R bd0568ec5c6f80c0ba5870a23aeeb2df
+P 723f901a63313b64a9f10516711fb6136526b79b
+R f0026590576c82bf02c9ed7b1fd9cc97
 U drh
-Z 6a19f7c88688bac3b6839a73befa2b33
+Z 4e2d6d22eda85e326fefafc64c333d74
index 6cebeafdb2a9c06545fbee062473d62d77d92f36..1a1fa457c3025b3fad88e7a7a0af449cbf7e6ce7 100644 (file)
@@ -1 +1 @@
-723f901a63313b64a9f10516711fb6136526b79b
\ No newline at end of file
+42511a7e12a70cf3436d25e4d069e5d309dfd678
\ No newline at end of file
index c4a8c2224392d3e0a1dd772afdec9b855e565e1a..4e78f1ebde2bce68a9653e6ac1592701f88f5d9d 100644 (file)
@@ -4864,9 +4864,11 @@ static int wherePathSolver(WhereInfo *pWInfo, double nRowEst){
     nFrom = nTo;
   }
 
-  /* TEMPORARY */
-  if( nFrom==0 ){ sqlite3DbFree(db, pSpace); return SQLITE_ERROR; }
-  assert( nFrom>0 );
+  if( nFrom==0 ){
+    sqlite3ErrorMsg(pWInfo->pParse, "no query solution");
+    sqlite3DbFree(db, pSpace);
+    return SQLITE_ERROR;
+  }
   
   /* Find the lowest cost path.  pFrom will be left pointing to that path */
   pFrom = aFrom;
@@ -5151,6 +5153,9 @@ WhereInfo *sqlite3WhereBegin(
      wherePathSolver(pWInfo, pWInfo->nRowOut);
      if( db->mallocFailed ) goto whereBeginError;
   }
+  if( pParse->nErr || db->mallocFailed ){
+    goto whereBeginError;
+  }
 #ifdef WHERETRACE_ENABLED
   if( sqlite3WhereTrace ){
     int ii;
@@ -5166,9 +5171,6 @@ WhereInfo *sqlite3WhereBegin(
   }
 #endif
   WHERETRACE(("*** Optimizer Finished ***\n"));
-  if( pParse->nErr || db->mallocFailed ){
-    goto whereBeginError;
-  }
 
 #if 0  /* FIXME: Add this back in? */
   /* If the caller is an UPDATE or DELETE statement that is requesting