/ Check-in [623ddbdb]
Login

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

Overview
Comment:Alternative fix for the double-initialization of type and collating sequence problem that leaves the estimated table size intact.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 623ddbdbf48d26dac58c593bcb9e7b184334ddfc
User & Date: drh 2015-04-21 17:17:47
Context
2015-04-22
01:33
When compiling for UAP, link against the new minimal MSVC runtime. check-in: 2cb94511 user: mistachkin tags: trunk
2015-04-21
17:17
Alternative fix for the double-initialization of type and collating sequence problem that leaves the estimated table size intact. check-in: 623ddbdb user: drh tags: trunk
17:07
Make sure the datatype and collating sequence of transients tables are not initialized more than once. Otherwise a memory leak results. check-in: 9e6beda2 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

  1696   1696     assert( pTab->nCol==pSelect->pEList->nExpr || db->mallocFailed );
  1697   1697     if( db->mallocFailed ) return;
  1698   1698     memset(&sNC, 0, sizeof(sNC));
  1699   1699     sNC.pSrcList = pSelect->pSrc;
  1700   1700     a = pSelect->pEList->a;
  1701   1701     for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
  1702   1702       p = a[i].pExpr;
  1703         -    if( pCol->zType ) break;
  1704         -    if( pCol->zColl ) break;
  1705         -    pCol->zType = sqlite3DbStrDup(db, columnType(&sNC, p,0,0,0, &pCol->szEst));
         1703  +    if( pCol->zType==0 ){
         1704  +      pCol->zType = sqlite3DbStrDup(db, columnType(&sNC, p,0,0,0, &pCol->szEst));
         1705  +    }
  1706   1706       szAll += pCol->szEst;
  1707   1707       pCol->affinity = sqlite3ExprAffinity(p);
  1708   1708       if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_NONE;
  1709   1709       pColl = sqlite3ExprCollSeq(pParse, p);
  1710         -    if( pColl ){
         1710  +    if( pColl && pCol->zColl==0 ){
  1711   1711         pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
  1712   1712       }
  1713   1713     }
  1714   1714     pTab->szTabRow = sqlite3LogEst(szAll*4);
  1715   1715   }
  1716   1716   
  1717   1717   /*