diff options
author | drh <> | 2023-03-28 11:18:04 +0000 |
---|---|---|
committer | drh <> | 2023-03-28 11:18:04 +0000 |
commit | 3cbf38c7832e234aab1848e32c104fe345e19e4f (patch) | |
tree | 6821e5e42b3e349d1c92cd308aed7df4a655cf32 /src/insert.c | |
parent | fc6c3936aac93d7c47c2780b0254422737a23090 (diff) | |
download | sqlite-3cbf38c7832e234aab1848e32c104fe345e19e4f.tar.gz sqlite-3cbf38c7832e234aab1848e32c104fe345e19e4f.zip |
Fix multiple problems with RETURNING on a DML statement against a view,
all inspired by [forum:/forumpost/dc3b92cfa0|forum post dc3b92cfa0].
(1) Do not allow a RETURNING clause to trick the code generator into thinking
that the view being updated has an INSTEAD OF trigger.
(2) Generate all result columns for a view in a DML statement.
(3) The automatic covering index for a view should cover all result columns
of the view.
FossilOrigin-Name: c8bedef0d61731c29ae34de1594222d15b578f9e2cddbbd5b74fb3059644fe0f
Diffstat (limited to 'src/insert.c')
-rw-r--r-- | src/insert.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/insert.c b/src/insert.c index 3abf715c9..423af7723 100644 --- a/src/insert.c +++ b/src/insert.c @@ -796,7 +796,7 @@ void sqlite3Insert( /* Cannot insert into a read-only table. */ - if( sqlite3IsReadOnly(pParse, pTab, tmask) ){ + if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){ goto insert_cleanup; } @@ -1243,7 +1243,7 @@ void sqlite3Insert( } /* Copy the new data already generated. */ - assert( pTab->nNVCol>0 ); + assert( pTab->nNVCol>0 || pParse->nErr>0 ); sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1); #ifndef SQLITE_OMIT_GENERATED_COLUMNS |