1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Merge changes from trunk into the alter-table-drop-column branch.

FossilOrigin-Name: 9ea640073f8809dfe2612ae1ea384a938b433f884c54d9e5aa3712de79397ac1
This commit is contained in:
drh
2021-02-18 22:47:34 +00:00
12 changed files with 193 additions and 73 deletions

View File

@@ -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;