1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Modify RETURNING so that it does not return changes implemented by

cascading foreign keys or by triggers.

FossilOrigin-Name: 6e62470a737cbde7f3fdcd027b98eb0b3dd11d063c63501d3c18448e93f5959f
This commit is contained in:
drh
2021-02-01 01:57:55 +00:00
parent 9407b6ef29
commit 7baf3d411b
3 changed files with 11 additions and 8 deletions

View File

@@ -742,9 +742,11 @@ Trigger *sqlite3TriggersExist(
}else if( p->op==TK_RETURNING ){
/* The first time a RETURNING trigger is seen, the "op" value tells
** us what time of trigger it should be. */
assert( sqlite3IsToplevel(pParse) );
p->op = op;
mask |= TRIGGER_AFTER;
}else if( p->bReturning && p->op==TK_INSERT && op==TK_UPDATE ){
}else if( p->bReturning && p->op==TK_INSERT && op==TK_UPDATE
&& sqlite3IsToplevel(pParse) ){
/* Also fire a RETURNING trigger for INSERT on the UPDATE of an UPSERT */
mask |= TRIGGER_AFTER;
}
@@ -1228,6 +1230,7 @@ void sqlite3CodeRowTrigger(
if( (p->op==op || (p->bReturning && p->op==TK_INSERT && op==TK_UPDATE))
&& p->tr_tm==tr_tm
&& checkColumnOverlap(p->pColumns, pChanges)
&& (sqlite3IsToplevel(pParse) || !p->bReturning)
){
u8 origOp = p->op;
p->op = op;