]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the xfer optimization for generated columns, so that VACUUM works again.
authordrh <drh@noemail.net>
Thu, 17 Oct 2019 16:16:34 +0000 (16:16 +0000)
committerdrh <drh@noemail.net>
Thu, 17 Oct 2019 16:16:34 +0000 (16:16 +0000)
FossilOrigin-Name: 8f67b89b04622c1509dc102a83be7a80057dc791625804fc2c294089c98b97e4

manifest
manifest.uuid
src/insert.c

index ad6cb4a6ff08c329574613b1ebd89cdae82673b0..67a4634513328eb3c22fbbd2339e7837f2bcb3e1 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Basic\sUPDATE\sfunctionality\sworking\sfor\sVIRTUAL\stables.
-D 2019-10-17T15:59:03.864
+C Fix\sthe\sxfer\soptimization\sfor\sgenerated\scolumns,\sso\sthat\sVACUUM\sworks\sagain.
+D 2019-10-17T16:16:34.306
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -486,7 +486,7 @@ F src/hash.c 8d7dda241d0ebdafb6ffdeda3149a412d7df75102cecfc1021c98d6219823b19
 F src/hash.h 9d56a9079d523b648774c1784b74b89bd93fac7b365210157482e4319a468f38
 F src/hwtime.h 747c1bbe9df21a92e9c50f3bbec1de841dc5e5da
 F src/in-operator.md 10cd8f4bcd225a32518407c2fb2484089112fd71
-F src/insert.c 3cf6462f09ef50916e5e859b56cb7bbf3a7e0b8f25a9cac0c99c572ba08c0779
+F src/insert.c 608b6d99b95f95a657b0fd13048ca002dfa8f1c212771c56bca510f1776f583d
 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa
 F src/loadext.c 4ddc65ae13c0d93db0ceedc8b14a28c8c260513448b0eb8c5a2ac375e3b6a85d
 F src/main.c 3e01f6a1c96643381b5f9d79e4ff7f2520bc5712197746fb0852283e78cccf66
@@ -1847,7 +1847,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 7bfe0f679d8951b3e925bdf549efa0f8d6b514eddeaca69cbfddbd9476cfff5f
-R d18b3efac452c2846ba92424700e5afb
+P c21959d4eb5d742a097a98e1874c0bf132dc962a97a65be1ab22d6ca3cf2b261
+R 6aa9977527f4824498ace24e1ab11d24
 U drh
-Z f4544de40926466a5b3f8950ba10f06a
+Z 5abd38c0a3e4636bc9783adf5f0cb09c
index 388e90dda54d9311428a2f5f5ec38d67d952196e..adeb66ff57813f2492b5052e8930d0f0413182d8 100644 (file)
@@ -1 +1 @@
-c21959d4eb5d742a097a98e1874c0bf132dc962a97a65be1ab22d6ca3cf2b261
\ No newline at end of file
+8f67b89b04622c1509dc102a83be7a80057dc791625804fc2c294089c98b97e4
\ No newline at end of file
index 1c628c670a6fe85cf436336629f8da849581f901..0abe244b34957ca3ef14dc04a8c8c312a091c031 100644 (file)
@@ -2289,6 +2289,10 @@ static int xferOptimization(
       return 0;    /* Neither table may have __hidden__ columns */
     }
 #endif
+    if( (pDestCol->colFlags & COLFLAG_GENERATED) !=
+        (pSrcCol->colFlags & COLFLAG_GENERATED) ){
+      return 0;    /* Both columns have the same generated type */
+    }
     if( pDestCol->affinity!=pSrcCol->affinity ){
       return 0;    /* Affinity must be the same on all columns */
     }
@@ -2299,7 +2303,7 @@ static int xferOptimization(
       return 0;    /* tab2 must be NOT NULL if tab1 is */
     }
     /* Default values for second and subsequent columns need to match. */
-    if( i>0 ){
+    if( (pDestCol->colFlags & COLFLAG_GENERATED)==0 && i>0 ){
       assert( pDestCol->pDflt==0 || pDestCol->pDflt->op==TK_SPAN );
       assert( pSrcCol->pDflt==0 || pSrcCol->pDflt->op==TK_SPAN );
       if( (pDestCol->pDflt==0)!=(pSrcCol->pDflt==0) 
@@ -2309,6 +2313,12 @@ static int xferOptimization(
         return 0;    /* Default values must be the same for all columns */
       }
     }
+    /* Generator expressions for generated columns must match */
+    if( (pDestCol->colFlags & COLFLAG_GENERATED)!=0 ){
+      if( sqlite3ExprCompare(0, pSrcCol->pDflt, pDestCol->pDflt, -1)!=0 ){
+         return 0;  /* Different generator expressions */
+      }
+    }
   }
   for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
     if( IsUniqueIndex(pDestIdx) ){