mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Report an error if the number of named columns in a VIEW is different
from the number of result columns in the SELECT statement that implements the VIEW. FossilOrigin-Name: 6e4ac0be2de1a16fcbb2a314504122ad95aa257e
This commit is contained in:
10
src/select.c
10
src/select.c
@@ -4861,7 +4861,17 @@ int sqlite3Select(
|
||||
struct SrcList_item *pItem = &pTabList->a[i];
|
||||
Select *pSub = pItem->pSelect;
|
||||
int isAggSub;
|
||||
Table *pTab = pItem->pTab;
|
||||
if( pSub==0 ) continue;
|
||||
|
||||
/* Catch mismatch in the declared columns of a view and the number of
|
||||
** columns in the SELECT on the RHS */
|
||||
if( pTab->nCol!=pSub->pEList->nExpr ){
|
||||
sqlite3ErrorMsg(pParse, "expected %d columns for '%s' but got %d",
|
||||
pTab->nCol, pTab->zName, pSub->pEList->nExpr);
|
||||
goto select_end;
|
||||
}
|
||||
|
||||
isAggSub = (pSub->selFlags & SF_Aggregate)!=0;
|
||||
if( flattenSubquery(pParse, p, i, isAgg, isAggSub) ){
|
||||
/* This subquery can be absorbed into its parent. */
|
||||
|
||||
Reference in New Issue
Block a user