]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Candidate fix for [d11a6e908f].
authordan <dan@noemail.net>
Sat, 20 Sep 2014 20:38:48 +0000 (20:38 +0000)
committerdan <dan@noemail.net>
Sat, 20 Sep 2014 20:38:48 +0000 (20:38 +0000)
FossilOrigin-Name: 89398880bcfff96e91d2a9c45774f5fb3209ffc1

manifest
manifest.uuid
src/select.c

index 70f1c0adaf7c40fc85575d7aa43349b71e9bb848..bf6dc5e87d7319f38ab95728aa7474a3e899d347 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sthe\sSELECTTRACE_ENABLE\smacro\sso\sthat\sit\sdoesn't\scause\sproblems\sfor\ntestfixture.\s\sAdd\snew\sSELECTTRACE()\scalls.
-D 2014-09-20T20:24:49.725
+C Candidate\sfix\sfor\s[d11a6e908f].
+D 2014-09-20T20:38:48.213
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in cf57f673d77606ab0f2d9627ca52a9ba1464146a
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -226,7 +226,7 @@ F src/printf.c 3a47f526b173813d9a7f4e7044007771ba68cde1
 F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece
 F src/resolve.c a3466128b52a86c466e47ac1a19e2174f7b5cf89
 F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e
-F src/select.c a2aac0a26b122b057f02464d6bfeeae3063583e7
+F src/select.c 3108c73dff614eb8771cd251bed41e3fa5dfe33f
 F src/shell.c dad23987c34faddb061a339da3e92e05ccc6935e
 F src/sqlite.h.in 8b018219ce988913e5977d5de9ab4beb33be23b6
 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad
@@ -1198,7 +1198,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 cbe0cf9ddf46f0a678c85d49bfa74e3b7712e1a1
-R 0e38789ee4b65d4c643d61f203d35efb
-U drh
-Z 34fd21290591a3034ab211fbb42794da
+P f1ba68f131d2f03e4a7bc50cde23a7609d384279
+R 9363b1bc0cd8b39c47583b734f41ef37
+U dan
+Z 365a1de296dc4c896c5c2cb92f759a75
index 5a4cc52a8157e2ed8217224c64e9ce6f5a77b2a3..3be54e65716ea6a5d945a04ee3ca0a8f8ee4d71e 100644 (file)
@@ -1 +1 @@
-f1ba68f131d2f03e4a7bc50cde23a7609d384279
\ No newline at end of file
+89398880bcfff96e91d2a9c45774f5fb3209ffc1
\ No newline at end of file
index 7b2dc4ab9ab91c76b615ada3805fb306f988be22..92d4c01b751a6dc8c98a0a2df168f6df0a22d6da 100644 (file)
@@ -3561,8 +3561,23 @@ static int flattenSubquery(
       pParent->pHaving = substExpr(db, pParent->pHaving, iParent, pSub->pEList);
     }
     if( pSub->pOrderBy ){
+      /* At this point, any non-zero iOrderByCol values indicate that the
+      ** ORDER BY column expression is identical to the iOrderByCol'th
+      ** expression returned by SELECT statement pSub. Since these values
+      ** do not necessarily correspond to columns in SELECT statement pParent,
+      ** zero them before transfering the ORDER BY clause.
+      **
+      ** Not doing this may cause an error if a subsequent call to this
+      ** function attempts to flatten a compound sub-query into pParent
+      ** (the only way this can happen is if the compound sub-query is
+      ** currently part of pSub->pSrc). See ticket [d11a6e908f].  */
+      ExprList *pOrderBy = pSub->pOrderBy;
+      for(i=0; i<pOrderBy->nExpr; i++){
+        pOrderBy->a[i].u.x.iOrderByCol = 0;
+      }
       assert( pParent->pOrderBy==0 );
-      pParent->pOrderBy = pSub->pOrderBy;
+      assert( pSub->pPrior==0 );
+      pParent->pOrderBy = pOrderBy;
       pSub->pOrderBy = 0;
     }else if( pParent->pOrderBy ){
       substExprList(db, pParent->pOrderBy, iParent, pSub->pEList);