]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Avoid trying to allocation zero bytes when analyzing a unique non-null index. faster-analyze
authordrh <drh@noemail.net>
Thu, 24 Jul 2014 20:25:16 +0000 (20:25 +0000)
committerdrh <drh@noemail.net>
Thu, 24 Jul 2014 20:25:16 +0000 (20:25 +0000)
FossilOrigin-Name: 85e2badeeb7f7599eb6fd35512f9bd524f0b1b3f

manifest
manifest.uuid
src/analyze.c

index f33fbbea5191b8722abba1b0ddf6f0a36aec97cc..6c8e62a3ab8b5923d1bfca950cc871a3f3bdb39e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\schange\stests\swhen\sanalyzing\ssingle-column\sunique\sindexes\safter\ngetting\spast\sthe\sinitial\sNULL\sentries.
-D 2014-07-24T19:54:20.150
+C Avoid\strying\sto\sallocation\szero\sbytes\swhen\sanalyzing\sa\sunique\snon-null\sindex.
+D 2014-07-24T20:25:16.037
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -161,7 +161,7 @@ F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b
 F sqlite3.1 3d8b83c91651f53472ca17599dae3457b8b89494
 F sqlite3.pc.in 48fed132e7cb71ab676105d2a4dc77127d8c1f3a
 F src/alter.c b00900877f766f116f9e16116f1ccacdc21d82f1
-F src/analyze.c 45216a14e7e71084859d2899cd323b2f597f8527
+F src/analyze.c 9799a65d8e8892e6eb96d0094a1d4fa6d7aebd0e
 F src/attach.c 3801129015ef59d76bf23c95ef9b0069d18a0c52
 F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34
 F src/backup.c a729e63cf5cd1829507cb7b8e89f99b95141bb53
@@ -1183,7 +1183,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 30033f965030a015fad15e532bcaba1314c8cc0f
-R e98a107e1f5891c465c70c3fe5e38f27
+P 4690e99c07024f40fafba1db8e4487b287b788a9
+R 665515c1fc4ab29e7e80bbd8e675bbe2
 U drh
-Z 7cfd64b5f36044a7bdee3831c72ee79f
+Z 06b30e9b7410b92f6a1122ec1ae06529
index bfe6770cbbf925bb9c8e26868dac102a0bd41014..e165c09bcc3b30ecb7a90771fba8c39ab66127ec 100644 (file)
@@ -1 +1 @@
-4690e99c07024f40fafba1db8e4487b287b788a9
\ No newline at end of file
+85e2badeeb7f7599eb6fd35512f9bd524f0b1b3f
\ No newline at end of file
index 9a64108384c2c7ce7a5f401a88191b83edc34af1..3931b2ff8c9d031ab8f314f7a1463944b6c856cb 100644 (file)
@@ -1014,7 +1014,6 @@ static void analyzeOneTable(
 
   for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
     int nCol;                     /* Number of columns in pIdx. "N" */
-    int *aGotoChng;               /* Array of jump instruction addresses */
     int addrRewind;               /* Address of "OP_Rewind iIdxCur" */
     int addrNextRow;              /* Address of "next_row:" */
     const char *zIdxName;         /* Name of the index */
@@ -1031,8 +1030,6 @@ static void analyzeOneTable(
       zIdxName = pIdx->zName;
       nColTest = pIdx->uniqNotNull ? pIdx->nKeyCol-1 : nCol-1;
     }
-    aGotoChng = sqlite3DbMallocRaw(db, sizeof(int)*nColTest);
-    if( aGotoChng==0 ) continue;
 
     /* Populate the register containing the index name. */
     sqlite3VdbeAddOp4(v, OP_String8, 0, regIdxname, 0, zIdxName, 0);
@@ -1116,6 +1113,10 @@ static void analyzeOneTable(
 
     if( nColTest>0 ){
       int endDistinctTest = sqlite3VdbeMakeLabel(v);
+      int *aGotoChng;               /* Array of jump instruction addresses */
+      aGotoChng = sqlite3DbMallocRaw(db, sizeof(int)*nColTest);
+      if( aGotoChng==0 ) continue;
+
       /*
       **  next_row:
       **   regChng = 0
@@ -1161,6 +1162,7 @@ static void analyzeOneTable(
         sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regPrev+i);
       }
       sqlite3VdbeResolveLabel(v, endDistinctTest);
+      sqlite3DbFree(db, aGotoChng);
     }
   
     /*
@@ -1247,7 +1249,6 @@ static void analyzeOneTable(
 
     /* End of analysis */
     sqlite3VdbeJumpHere(v, addrRewind);
-    sqlite3DbFree(db, aGotoChng);
   }