/ Check-in [7e5b56b1]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bug fix in sqlite3SelectDup(). Make sure the pNext pointer is valid.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tree-explain
Files: files | file ages | folders
SHA1: 7e5b56b1c602d4adfd4496a9c877f3b685b2d360
User & Date: drh 2011-12-07 01:47:27
References
2011-12-07
01:55
Cherrypick the [7e5b56b1c6] fix for the sqlite3SelectDup() routine into trunk. check-in: 7fc53509 user: drh tags: trunk
Context
2011-12-07
15:33
More compact notation for the parse-tree view. check-in: 0eb3f8b1 user: drh tags: tree-explain
01:47
Bug fix in sqlite3SelectDup(). Make sure the pNext pointer is valid. check-in: 7e5b56b1 user: drh tags: tree-explain
01:23
Improvements to the data-structure explain subsystem. Most queries now give a reasonably detailed graph of their parse tree. check-in: 0aa7d3d2 user: drh tags: tree-explain
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/expr.c.

   936    936       struct IdList_item *pOldItem = &p->a[i];
   937    937       pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
   938    938       pNewItem->idx = pOldItem->idx;
   939    939     }
   940    940     return pNew;
   941    941   }
   942    942   Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){
   943         -  Select *pNew;
          943  +  Select *pNew, *pPrior;
   944    944     if( p==0 ) return 0;
   945    945     pNew = sqlite3DbMallocRaw(db, sizeof(*p) );
   946    946     if( pNew==0 ) return 0;
   947    947     pNew->pEList = sqlite3ExprListDup(db, p->pEList, flags);
   948    948     pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags);
   949    949     pNew->pWhere = sqlite3ExprDup(db, p->pWhere, flags);
   950    950     pNew->pGroupBy = sqlite3ExprListDup(db, p->pGroupBy, flags);
   951    951     pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags);
   952    952     pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags);
   953    953     pNew->op = p->op;
   954         -  pNew->pPrior = sqlite3SelectDup(db, p->pPrior, flags);
          954  +  pNew->pPrior = pPrior = sqlite3SelectDup(db, p->pPrior, flags);
          955  +  if( pPrior ) pPrior->pNext = pNew;
          956  +  pNew->pNext = 0;
   955    957     pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags);
   956    958     pNew->pOffset = sqlite3ExprDup(db, p->pOffset, flags);
   957    959     pNew->iLimit = 0;
   958    960     pNew->iOffset = 0;
   959    961     pNew->selFlags = p->selFlags & ~SF_UsesEphemeral;
   960    962     pNew->pRightmost = 0;
   961    963     pNew->addrOpenEphm[0] = -1;