diff options
author | drh <> | 2021-02-18 22:47:34 +0000 |
---|---|---|
committer | drh <> | 2021-02-18 22:47:34 +0000 |
commit | a7da40f377c368fbd3eea9c2befb74ef6cd03f4c (patch) | |
tree | a1014db371a3a19c2030e164154556a9eec35939 /src/select.c | |
parent | 678f3b33cc057f8253444343575d24ab093d8ddf (diff) | |
parent | a55a839ab327630511f37098ed25d5df71b558d3 (diff) | |
download | sqlite-a7da40f377c368fbd3eea9c2befb74ef6cd03f4c.tar.gz sqlite-a7da40f377c368fbd3eea9c2befb74ef6cd03f4c.zip |
Merge changes from trunk into the alter-table-drop-column branch.
FossilOrigin-Name: 9ea640073f8809dfe2612ae1ea384a938b433f884c54d9e5aa3712de79397ac1
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/select.c b/src/select.c index f52c2629a..6d5f049f3 100644 --- a/src/select.c +++ b/src/select.c @@ -2086,6 +2086,7 @@ void sqlite3SelectAddColumnTypeAndCollation( for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){ const char *zType; int n, m; + pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT); p = a[i].pExpr; zType = columnType(&sNC, p, 0, 0, 0); /* pCol->szEst = ... // Column size est for SELECT tables never used */ @@ -5793,6 +5794,15 @@ static struct SrcList_item *isSelfJoinView( return 0; } +/* +** Deallocate a single AggInfo object +*/ +static void agginfoFree(sqlite3 *db, AggInfo *p){ + sqlite3DbFree(db, p->aCol); + sqlite3DbFree(db, p->aFunc); + sqlite3DbFreeNN(db, p); +} + #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION /* ** Attempt to transform a query of the form @@ -6537,11 +6547,13 @@ int sqlite3Select( ** SELECT statement. */ pAggInfo = sqlite3DbMallocZero(db, sizeof(*pAggInfo) ); - if( pAggInfo==0 ){ + if( pAggInfo ){ + sqlite3ParserAddCleanup(pParse, + (void(*)(sqlite3*,void*))agginfoFree, pAggInfo); + } + if( db->mallocFailed ){ goto select_end; } - pAggInfo->pNext = pParse->pAggList; - pParse->pAggList = pAggInfo; pAggInfo->selId = p->selId; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; |