aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <dan@noemail.net>2013-04-03 11:38:36 +0000
committerdan <dan@noemail.net>2013-04-03 11:38:36 +0000
commitf7679ad19eaaf249bd803010eab2da14f21c61e9 (patch)
tree108306cf36188760330cfa845c6124ae0b6fb4cb /src
parent227a1c482cb2e725712f5a5f75fa0fd977a586ef (diff)
downloadsqlite-f7679ad19eaaf249bd803010eab2da14f21c61e9.tar.gz
sqlite-f7679ad19eaaf249bd803010eab2da14f21c61e9.zip
When moving a page to make way for the root page of a new table or index in an auto-vacuum database, save the positions of any cursors that may be holding xFetch references to the page being moved.
FossilOrigin-Name: 9d9b1da54a555e8fb6037d63d1952458c12956d2
Diffstat (limited to 'src')
-rw-r--r--src/btree.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/btree.c b/src/btree.c
index a1877ebfe..dd37112c3 100644
--- a/src/btree.c
+++ b/src/btree.c
@@ -7269,6 +7269,14 @@ static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){
u8 eType = 0;
Pgno iPtrPage = 0;
+ /* Save the positions of any open cursors. This is required in
+ ** case they are holding a reference to an xFetch reference
+ ** corresponding to page pgnoRoot. */
+ rc = saveAllCursors(pBt, 0, 0);
+ if( rc!=SQLITE_OK ){
+ return rc;
+ }
+
releasePage(pPageMove);
/* Move the page currently at pgnoRoot to pgnoMove. */