/ Check-in [90b197489a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a faulty assert() in the btree part of the "PRAGMA page_size = ?" code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:90b197489a37e01dcb2f3a8182848c1301e1757b
User & Date: dan 2015-05-05 10:03:08
Context
2015-05-05
10:46
Spell SQLITE_OMIT_VIRTUALTABLE correctly in a #if in dbstat.c. check-in: d2cb1becc0 user: drh tags: trunk
10:03
Fix a faulty assert() in the btree part of the "PRAGMA page_size = ?" code. check-in: 90b197489a user: dan tags: trunk
01:09
Fix a problem in Makefile.in that only comes up on Windows with MinGW. check-in: 5f3cd68b3e user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/btree.c.

2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
  if( nReserve<0 ){
    nReserve = pBt->pageSize - pBt->usableSize;
  }
  assert( nReserve>=0 && nReserve<=255 );
  if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&
        ((pageSize-1)&pageSize)==0 ){
    assert( (pageSize & 7)==0 );
    assert( !pBt->pPage1 && !pBt->pCursor );
    pBt->pageSize = (u32)pageSize;
    freeTempSpace(pBt);
  }
  rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);
  pBt->usableSize = pBt->pageSize - (u16)nReserve;
  if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED;
  sqlite3BtreeLeave(p);







|







2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
  if( nReserve<0 ){
    nReserve = pBt->pageSize - pBt->usableSize;
  }
  assert( nReserve>=0 && nReserve<=255 );
  if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&
        ((pageSize-1)&pageSize)==0 ){
    assert( (pageSize & 7)==0 );
    assert( !pBt->pCursor );
    pBt->pageSize = (u32)pageSize;
    freeTempSpace(pBt);
  }
  rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve);
  pBt->usableSize = pBt->pageSize - (u16)nReserve;
  if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED;
  sqlite3BtreeLeave(p);

Changes to test/pagesize.test.

211
212
213
214
215
216
217
218


















219
      CREATE TABLE t1(x);
      CREATE TEMP TABLE t2(y);
      PRAGMA main.page_size;
      PRAGMA temp.page_size;
    "
  } [list $PGSZ $PGSZ]
}



















finish_test








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
      CREATE TABLE t1(x);
      CREATE TEMP TABLE t2(y);
      PRAGMA main.page_size;
      PRAGMA temp.page_size;
    "
  } [list $PGSZ $PGSZ]
}

reset_db
do_execsql_test pagesize-3.1 {
  BEGIN;
  SELECT * FROM sqlite_master;
  PRAGMA page_size=2048;
  PRAGMA main.page_size;
} {1024}
do_execsql_test pagesize-3.2 {
  CREATE TABLE t1(x);
  COMMIT;
}
do_execsql_test pagesize-3.3 {
  BEGIN;
    PRAGMA page_size = 2048;
  COMMIT;
  PRAGMA main.page_size;
} {1024}

finish_test