]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Allow the xfer optimization to proceed if the DEFAULT on the very first
authordrh <drh@noemail.net>
Sat, 26 Apr 2014 17:52:08 +0000 (17:52 +0000)
committerdrh <drh@noemail.net>
Sat, 26 Apr 2014 17:52:08 +0000 (17:52 +0000)
column of the two tables is different.  This is a refinement of the
fix for ticket [f67b41381a].

FossilOrigin-Name: 349f483499dd685a8da94923b6bd810a52e5e236

manifest
manifest.uuid
src/insert.c
test/tkt-f67b41381a.test

index 498632b3502d02b00e2c39210851293310daccad..3b524ffeaf3612c2dc53a04764f5b8be4f866672 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\stransfering\srecords\sbetween\stables\sunless\sthe\sdefault\svalues\sfor\sall\scolumns\sare\sthe\ssame.\sFix\sfor\s[f67b41381a].
-D 2014-04-26T14:07:57.099
+C Allow\sthe\sxfer\soptimization\sto\sproceed\sif\sthe\sDEFAULT\son\sthe\svery\sfirst\ncolumn\sof\sthe\stwo\stables\sis\sdifferent.\s\sThis\sis\sa\srefinement\sof\sthe\nfix\sfor\sticket\s[f67b41381a].
+D 2014-04-26T17:52:08.640
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in 2ef13430cd359f7b361bb863504e227b25cc7f81
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -181,7 +181,7 @@ F src/global.c 1d7bb7ea8254ae6a68ed9bfaf65fcb3d1690b486
 F src/hash.c d139319967164f139c8d1bb8a11b14db9c4ba3cd
 F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22
 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
-F src/insert.c 08de23111439c650cac52861a5b80d10d9d40560
+F src/insert.c ab34bea5af4fee9f956a0805a32463fb7f674d00
 F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d
 F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12
 F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b
@@ -906,7 +906,7 @@ F test/tkt-d11f09d36e.test d999b548fef885d1d1afa49a0e8544ecf436869d
 F test/tkt-d635236375.test 9d37e988b47d87505bc9445be0ca447002df5d09
 F test/tkt-d82e3f3721.test bcc0dfba658d15bab30fd4a9320c9e35d214ce30
 F test/tkt-f3e5abed55.test d5a0126118142d13e27f6ce9f4c47096e9321c00
-F test/tkt-f67b41381a.test 18d3477b6fe82e6c5ec5e233d79642d7e6d0de77
+F test/tkt-f67b41381a.test a23bc124c981662db712167bacd0ed8ad11abac9
 F test/tkt-f777251dc7a.test af6531446c64bfd268416f07b4df7be7f9c749d2
 F test/tkt-f7b4edec.test d998a08ff2b18b7f62edce8e3044317c45efe6c7
 F test/tkt-f973c7ac31.test 28ef85c7f015477916795246d8286aeda39d4ead
@@ -1163,7 +1163,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1
 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01
 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff
-P 5ada136f43ce744ae8c349eff39838eb44611b6e
-R 72b6179d3d1a0fd8f077c8cde285a253
-U dan
-Z 7eecc39cd60ba5323d907c2532e97144
+P f8c4c495e6de1f124d205383d4bafa46accbff5c
+R efe95b9fe528a9f472987911752f5742
+U drh
+Z 366467002d461344ec8032510917cbba
index 6aa5d7fb27d4a50f69dd7f3147b61d61ff4782c7..26e36016efbbaedc5692e126be7237c0189a0061 100644 (file)
@@ -1 +1 @@
-f8c4c495e6de1f124d205383d4bafa46accbff5c
\ No newline at end of file
+349f483499dd685a8da94923b6bd810a52e5e236
\ No newline at end of file
index 3c77761b32fa4cfea3d4ed75c5fdb19913dc9fdf..909bc274742e51ed938458955a247fb03ed2471d 100644 (file)
@@ -1876,8 +1876,10 @@ static int xferOptimization(
     if( pDestCol->notNull && !pSrcCol->notNull ){
       return 0;    /* tab2 must be NOT NULL if tab1 is */
     }
-    if( (pDestCol->zDflt==0)!=(pSrcCol->zDflt==0) 
-     || (pDestCol->zDflt && strcmp(pDestCol->zDflt, pSrcCol->zDflt))
+    /* Default values for second and subsequent columns need to match. */
+    if( i>0
+     && ((pDestCol->zDflt==0)!=(pSrcCol->zDflt==0) 
+         || (pDestCol->zDflt && strcmp(pDestCol->zDflt, pSrcCol->zDflt)!=0))
     ){
       return 0;    /* Default values must be the same for all columns */
     }
index d15d9853420a1f3386ffb3312350912d8ee7ab8a..1ddec988cd108f90bd3d96a12e60bbf293d9bd66 100644 (file)
@@ -30,8 +30,13 @@ foreach {tn tbls xfer} {
   2 { CREATE TABLE t1(a, b DEFAULT 'x'); CREATE TABLE t2(a, b) }             0
   3 { CREATE TABLE t1(a, b DEFAULT 'x'); CREATE TABLE t2(a, b DEFAULT 'x') } 1
   4 { CREATE TABLE t1(a, b DEFAULT NULL); CREATE TABLE t2(a, b) }            0
-  5 { CREATE TABLE t1(a DEFAULT 2, b); CREATE TABLE t2(a DEFAULT 1, b) }     0
+  5 { CREATE TABLE t1(a DEFAULT 2, b); CREATE TABLE t2(a DEFAULT 1, b) }     1
   6 { CREATE TABLE t1(a DEFAULT 1, b); CREATE TABLE t2(a DEFAULT 1, b) }     1
+  7 { CREATE TABLE t1(a DEFAULT 1, b DEFAULT 1);
+      CREATE TABLE t2(a DEFAULT 3, b DEFAULT 1) }                            1
+  8 { CREATE TABLE t1(a DEFAULT 1, b DEFAULT 1);
+      CREATE TABLE t2(a DEFAULT 3, b DEFAULT 3) }                            0
+
 } {
 
   execsql { DROP TABLE t1; DROP TABLE t2 }
@@ -46,5 +51,3 @@ foreach {tn tbls xfer} {
 }
 
 finish_test
-
-