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

When resolving names in the RETURNING clause, do not accept trigger names

even within subquires.  See
[forum:/info/34c81d83c9177f46|forum post 34c81d83c9177f46] for context.

FossilOrigin-Name: fd4ea3f626b6e4957d56c2369be711895735cfc37cfde65650a6682ad5a3eb1a
This commit is contained in:
drh
2021-03-31 23:56:55 +00:00
parent d75aeee535
commit 22af584e3e
4 changed files with 29 additions and 10 deletions

View File

@@ -376,8 +376,10 @@ static int lookupName(
if( pParse->pTriggerTab!=0 ){
int op = pParse->eTriggerOp;
assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
if( pParse->bReturning && (pNC->ncFlags & NC_UBaseReg)!=0 ){
if( zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0 ){
if( pParse->bReturning ){
if( (pNC->ncFlags & NC_UBaseReg)!=0
&& (zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
){
pExpr->iTable = op!=TK_DELETE;
pTab = pParse->pTriggerTab;
}