aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <dan@noemail.net>2018-12-28 17:45:08 +0000
committerdan <dan@noemail.net>2018-12-28 17:45:08 +0000
commit1d4b16405b1463dea57d3f704ecb38f6e3038501 (patch)
tree9e78aee9fcd049a11899e77523e2f6499470a292 /src
parenteefc72d12fa7b76393e9a1092dfc8278260da1d9 (diff)
downloadsqlite-1d4b16405b1463dea57d3f704ecb38f6e3038501.tar.gz
sqlite-1d4b16405b1463dea57d3f704ecb38f6e3038501.zip
Fix a problem causing the sqlite_master entry corresponding to a virtual table
to be removed by a DROP TABLE even if the call to the vtabs xDestroy() method failed. FossilOrigin-Name: 0140f6dbfbea93eadcd7f727d84064a0c0d1f0806dbe3e5ef1017da603157e3b
Diffstat (limited to 'src')
-rw-r--r--src/build.c1
-rw-r--r--src/vdbe.c1
-rw-r--r--src/vdbeaux.c1
3 files changed, 3 insertions, 0 deletions
diff --git a/src/build.c b/src/build.c
index e60c1e0b1..ab90e12d2 100644
--- a/src/build.c
+++ b/src/build.c
@@ -2638,6 +2638,7 @@ void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){
*/
if( IsVirtual(pTab) ){
sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0);
+ sqlite3MayAbort(pParse);
}
sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);
sqlite3ChangeCookie(pParse, iDb);
diff --git a/src/vdbe.c b/src/vdbe.c
index 590964713..26382bcd4 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -6849,6 +6849,7 @@ case OP_VDestroy: {
db->nVDestroy++;
rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z);
db->nVDestroy--;
+ assert( p->errorAction==OE_Abort && p->usesStmtJournal );
if( rc ) goto abort_due_to_error;
break;
}
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 8d4cf6018..dd78c3d31 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -603,6 +603,7 @@ int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
while( (pOp = opIterNext(&sIter))!=0 ){
int opcode = pOp->opcode;
if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename
+ || opcode==OP_VDestroy
|| ((opcode==OP_Halt || opcode==OP_HaltIfNull)
&& ((pOp->p1&0xff)==SQLITE_CONSTRAINT && pOp->p2==OE_Abort))
){