diff options
author | dan <dan@noemail.net> | 2019-03-15 16:17:32 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2019-03-15 16:17:32 +0000 |
commit | 1f3b284b11bdc781dba7fe655fd287b2d9bef029 (patch) | |
tree | 09d098b3ea5b532e5b2e7c9cd915772ab84bd4b7 /src | |
parent | a49774f478cdbc8f31e720f2cd871ed2543612df (diff) | |
download | sqlite-1f3b284b11bdc781dba7fe655fd287b2d9bef029.tar.gz sqlite-1f3b284b11bdc781dba7fe655fd287b2d9bef029.zip |
Ensure that ALTER TABLE commands open statement transactions. Fix for [596d059a].
FossilOrigin-Name: 0f2129f59f7df929106e2af876c2976dea6528c1dc1850d64cddb256f20e121a
Diffstat (limited to 'src')
-rw-r--r-- | src/alter.c | 12 | ||||
-rw-r--r-- | src/vdbeaux.c | 1 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/alter.c b/src/alter.c index e18633858..d71074795 100644 --- a/src/alter.c +++ b/src/alter.c @@ -166,15 +166,15 @@ void sqlite3AlterRenameTable( } #endif - /* Begin a transaction for database iDb. - ** Then modify the schema cookie (since the ALTER TABLE modifies the - ** schema). Open a statement transaction if the table is a virtual - ** table. - */ + /* Begin a transaction for database iDb. Then modify the schema cookie + ** (since the ALTER TABLE modifies the schema). Call sqlite3MayAbort(), + ** as the scalar functions (e.g. sqlite_rename_table()) invoked by the + ** nested SQL may raise an exception. */ v = sqlite3GetVdbe(pParse); if( v==0 ){ goto exit_rename_table; } + sqlite3MayAbort(pParse); /* figure out how many UTF-8 characters are in zName */ zTabName = pTab->zName; @@ -243,7 +243,6 @@ void sqlite3AlterRenameTable( int i = ++pParse->nMem; sqlite3VdbeLoadString(v, i, zName); sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB); - sqlite3MayAbort(pParse); } #endif @@ -564,6 +563,7 @@ void sqlite3AlterRenameColumn( ** uses the sqlite_rename_column() SQL function to compute the new ** CREATE statement text for the sqlite_master table. */ + sqlite3MayAbort(pParse); zNew = sqlite3NameFromToken(db, pNew); if( !zNew ) goto exit_rename_column; assert( pNew->n>0 ); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index aba75500f..1ba015fe1 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -637,6 +637,7 @@ int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ int opcode = pOp->opcode; if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename || opcode==OP_VDestroy + || (opcode==OP_Function0 && pOp->p4.pFunc->funcFlags&SQLITE_FUNC_INTERNAL) || ((opcode==OP_Halt || opcode==OP_HaltIfNull) && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort)) ){ |