mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Prevent the flattening or where-term push-down optimizations from obscuring
misuses of SQL row values that can lead to crashes or assert() failures. FossilOrigin-Name: 433d16ff3adfede3be53d5b0e0512f37e225591b
This commit is contained in:
28
src/expr.c
28
src/expr.c
@@ -2355,6 +2355,28 @@ void sqlite3SubselectError(Parse *pParse, int nActual, int nExpect){
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Expression pExpr is a vector that has been used in a context where
|
||||
** it is not permitted. If pExpr is a sub-select vector, this routine
|
||||
** loads the Parse object with a message of the form:
|
||||
**
|
||||
** "sub-select returns N columns - expected 1"
|
||||
**
|
||||
** Or, if it is a regular scalar vector:
|
||||
**
|
||||
** "row value misused"
|
||||
*/
|
||||
void sqlite3VectorErrorMsg(Parse *pParse, Expr *pExpr){
|
||||
#ifndef SQLITE_OMIT_SUBQUERY
|
||||
if( pExpr->flags & EP_xIsSelect ){
|
||||
sqlite3SubselectError(pParse, pExpr->x.pSelect->pEList->nExpr, 1);
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
sqlite3ErrorMsg(pParse, "row value misused");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Generate code for scalar subqueries used as a subquery expression, EXISTS,
|
||||
** or IN operators. Examples:
|
||||
@@ -2637,11 +2659,7 @@ int sqlite3ExprCheckIN(Parse *pParse, Expr *pIn){
|
||||
return 1;
|
||||
}
|
||||
}else if( nVector!=1 ){
|
||||
if( (pIn->pLeft->flags & EP_xIsSelect) ){
|
||||
sqlite3SubselectError(pParse, nVector, 1);
|
||||
}else{
|
||||
sqlite3ErrorMsg(pParse, "row value misused");
|
||||
}
|
||||
sqlite3VectorErrorMsg(pParse, pIn->pLeft);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user