diff options
author | drh <drh@noemail.net> | 2017-12-29 13:35:09 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-12-29 13:35:09 +0000 |
commit | 7a8573bafaba8b341ec033a0ecc810afeceda94e (patch) | |
tree | 67a72353c4313c2cadb24a46a54af0cf87104317 /src/select.c | |
parent | 2fc865c1153d739208657ea652f74426bf20f678 (diff) | |
parent | ee052a1c941920dab3fab38785fbf03237677b7a (diff) | |
download | sqlite-7a8573bafaba8b341ec033a0ecc810afeceda94e.tar.gz sqlite-7a8573bafaba8b341ec033a0ecc810afeceda94e.zip |
Merge recent enhancements from trunk.
FossilOrigin-Name: 6251e438f2a76170fd1e95aa512a46086ed88ab93b9b97a1dba97c4558689305
Diffstat (limited to 'src/select.c')
-rw-r--r-- | src/select.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/select.c b/src/select.c index 97eaf21b4..1a4b0a93a 100644 --- a/src/select.c +++ b/src/select.c @@ -1381,8 +1381,9 @@ static const char *columnTypeImpl( assert( pExpr!=0 ); assert( pNC->pSrcList!=0 ); + assert( pExpr->op!=TK_AGG_COLUMN ); /* This routine runes before aggregates + ** are processed */ switch( pExpr->op ){ - case TK_AGG_COLUMN: case TK_COLUMN: { /* The expression is a column. Locate the table the column is being ** extracted from in NameContext.pSrcList. This table may be real @@ -1391,8 +1392,6 @@ static const char *columnTypeImpl( Table *pTab = 0; /* Table structure column is extracted from */ Select *pS = 0; /* Select the column is extracted from */ int iCol = pExpr->iColumn; /* Index of column in pTab */ - testcase( pExpr->op==TK_AGG_COLUMN ); - testcase( pExpr->op==TK_COLUMN ); while( pNC && !pTab ){ SrcList *pTabList = pNC->pSrcList; for(j=0;j<pTabList->nSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++); @@ -1596,6 +1595,7 @@ static void generateColumnNames( if( pParse->colNamesSet || db->mallocFailed ) return; /* Column names are determined by the left-most term of a compound select */ while( pSelect->pPrior ) pSelect = pSelect->pPrior; + SELECTTRACE(1,pParse,pSelect,("generating column names\n")); pTabList = pSelect->pSrc; pEList = pSelect->pEList; assert( v!=0 ); @@ -1704,12 +1704,12 @@ int sqlite3ColumnsFromExprList( pColExpr = pColExpr->pRight; assert( pColExpr!=0 ); } - if( (pColExpr->op==TK_COLUMN || pColExpr->op==TK_AGG_COLUMN) - && pColExpr->pTab!=0 - ){ + assert( pColExpr->op!=TK_AGG_COLUMN ); + if( pColExpr->op==TK_COLUMN ){ /* For columns use the column name name */ int iCol = pColExpr->iColumn; Table *pTab = pColExpr->pTab; + assert( pTab!=0 ); if( iCol<0 ) iCol = pTab->iPKey; zName = iCol>=0 ? pTab->aCol[iCol].zName : "rowid"; }else if( pColExpr->op==TK_ID ){ |