diff options
author | dan <Dan Kennedy> | 2021-04-06 13:53:10 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2021-04-06 13:53:10 +0000 |
commit | 2a1aeaa36ecb976733920a24745e94beabfb82af (patch) | |
tree | 8e96d910c54e89988e89fe441d2a9622e28215ff /src | |
parent | 8119aab3c8b42e2e3ae4aa433bdde4cb8404d2d0 (diff) | |
download | sqlite-2a1aeaa36ecb976733920a24745e94beabfb82af.tar.gz sqlite-2a1aeaa36ecb976733920a24745e94beabfb82af.zip |
Handle "RETURNING rowid" clauses attached to INSERTs on views without causing an assert() to fail. Fixes dbsqlfuzz crash 0081f863d7b2002045ac2361879fc80dfebb98f1.
FossilOrigin-Name: 9c5b7386d013a7f22a93c69722c4648e2ab60eef180f48b5470bfea6fa74b3da
Diffstat (limited to 'src')
-rw-r--r-- | src/insert.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/insert.c b/src/insert.c index 2fbfcce4a..dc63fe60f 100644 --- a/src/insert.c +++ b/src/insert.c @@ -1268,6 +1268,11 @@ void sqlite3Insert( regIns, aRegIdx, 0, appendFlag, bUseSeek ); } + }else if( pParse->bReturning ){ + /* If there is a RETURNING clause, populate the rowid register with + ** constant value -1, in case one or more of the returned expressions + ** refer to the "rowid" of the view. */ + sqlite3VdbeAddOp2(v, OP_Integer, -1, regRowid); } /* Update the count of rows that are inserted |