aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-10-24 19:35:26 +0000
committerdrh <drh@noemail.net>2019-10-24 19:35:26 +0000
commit06baba54b4d097113e8a425010d31f044df57f4b (patch)
tree7080ab7df1e0b3735826f5a9b500dcc5305845ce /src
parent31269a9f5ff767cb1b9e910b41124fa11aca32f2 (diff)
downloadsqlite-06baba54b4d097113e8a425010d31f044df57f4b.tar.gz
sqlite-06baba54b4d097113e8a425010d31f044df57f4b.zip
Correction to check-in [bec5b6d4d083556d] so that it detects *all*
triggers that might perturb the insertion cursor. Ticket [50c09fc2cf0d91ce]. FossilOrigin-Name: 521f1d36282549488a47a434484a24924ee970d29f05a8ae499b7d536bcd692b
Diffstat (limited to 'src')
-rw-r--r--src/insert.c4
-rw-r--r--src/vdbe.h3
-rw-r--r--src/vdbeaux.c7
3 files changed, 9 insertions, 5 deletions
diff --git a/src/insert.c b/src/insert.c
index 3bb1ee706..77b402c7e 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -1058,9 +1058,7 @@ void sqlite3Insert(
** cursor that is disturbed. And these instructions both clear the
** VdbeCursor.seekResult variable, disabling the OPFLAG_USESEEKRESULT
** functionality. */
- bUseSeek = (isReplace==0 || (pTrigger==0 &&
- ((db->flags & SQLITE_ForeignKeys)==0 || sqlite3FkReferences(pTab)==0)
- ));
+ bUseSeek = (isReplace==0 || !sqlite3VdbeHasSubProgram(v));
sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur,
regIns, aRegIdx, 0, appendFlag, bUseSeek
);
diff --git a/src/vdbe.h b/src/vdbe.h
index e3aaaa1ce..b59fc7a26 100644
--- a/src/vdbe.h
+++ b/src/vdbe.h
@@ -278,9 +278,8 @@ UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo*);
typedef int (*RecordCompare)(int,const void*,UnpackedRecord*);
RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*);
-#ifndef SQLITE_OMIT_TRIGGER
void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
-#endif
+int sqlite3VdbeHasSubProgram(Vdbe*);
int sqlite3NotPureFunc(sqlite3_context*);
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index c89b7d419..86980b4dd 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -1099,6 +1099,13 @@ void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){
}
/*
+** Return true if the given Vdbe has any SubPrograms.
+*/
+int sqlite3VdbeHasSubProgram(Vdbe *pVdbe){
+ return pVdbe->pProgram!=0;
+}
+
+/*
** Change the opcode at addr into OP_Noop
*/
int sqlite3VdbeChangeToNoop(Vdbe *p, int addr){