mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Raise an error if a term of the form "TABLE.*" appears in the RETURNING clause,
as SQLite does not (yet) know how to handle that. Ticket [132994c8b1063bfb]. FossilOrigin-Name: 3039bcaff95bb5d096c80b5eefdaeda6abd1d1337e829f32fd28a968f663f481
This commit is contained in:
@@ -823,6 +823,25 @@ SrcList *sqlite3TriggerStepSrc(
|
||||
return pSrc;
|
||||
}
|
||||
|
||||
/*
|
||||
** Return true if the pExpr term from the RETURNING clause argument
|
||||
** list is of the form "*". Raise an error if the terms if of the
|
||||
** form "table.*".
|
||||
*/
|
||||
static int isAsteriskTerm(
|
||||
Parse *pParse, /* Parsing context */
|
||||
Expr *pTerm /* A term in the RETURNING clause */
|
||||
){
|
||||
assert( pTerm!=0 );
|
||||
if( pTerm->op==TK_ASTERISK ) return 1;
|
||||
if( pTerm->op!=TK_DOT ) return 0;
|
||||
assert( pTerm->pRight!=0 );
|
||||
assert( pTerm->pLeft!=0 );
|
||||
if( pTerm->pRight->op!=TK_ASTERISK ) return 0;
|
||||
sqlite3ErrorMsg(pParse, "RETURNING may not use \"TABLE.*\" wildcards");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* The input list pList is the list of result set terms from a RETURNING
|
||||
** clause. The table that we are returning from is pTab.
|
||||
**
|
||||
@@ -840,7 +859,8 @@ static ExprList *sqlite3ExpandReturning(
|
||||
|
||||
for(i=0; i<pList->nExpr; i++){
|
||||
Expr *pOldExpr = pList->a[i].pExpr;
|
||||
if( ALWAYS(pOldExpr!=0) && pOldExpr->op==TK_ASTERISK ){
|
||||
if( NEVER(pOldExpr==0) ) continue;
|
||||
if( isAsteriskTerm(pParse, pOldExpr) ){
|
||||
int jj;
|
||||
for(jj=0; jj<pTab->nCol; jj++){
|
||||
Expr *pNewExpr;
|
||||
|
Reference in New Issue
Block a user