From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "enum" |
|---|
| subject | "Format:SQLite database file" |
|---|
| claim | "The first byte of an SQLite B-tree page header (offset 100 on page 1) is its type: 0x02 index interior, 0x05 table interior, 0x0A index leaf, 0x0D table leaf, combinations of the flags intkey 0x01, zerodata 0x02, leafdata 0x04 and leaf 0x08. Leaf headers are 8 bytes, interior headers 12 (the last u32 is the right-most child)." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:SQLite database file" |
|---|
| observed_in | |
|---|
|
|---|
| data | | name | "SQLiteBtreePageType" |
|---|
| underlying_type | "uint8_t" |
|---|
| values | | name | "INDEX_INTERIOR" |
|---|
| value | "0x02" |
|---|
| notes | "zerodata; cells: u32 left child, varint payload size, payload, [u32 overflow]" |
|---|
|
| name | "TABLE_INTERIOR" |
|---|
| value | "0x05" |
|---|
| notes | "intkey|leafdata; cells: u32 left child, varint rowid" |
|---|
|
| name | "INDEX_LEAF" |
|---|
| value | "0x0A" |
|---|
| notes | "zerodata|leaf; cells: varint payload size, payload, [u32 overflow]" |
|---|
|
| name | "TABLE_LEAF" |
|---|
| value | "0x0D" |
|---|
| notes | "intkey|leafdata|leaf; cells: varint payload size, varint rowid, payload, [u32 overflow]" |
|---|
|
|
|---|
| complete | true |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "Page header table and the PTF_INTKEY/ZERODATA/LEAFDATA/LEAF flag values" |
|---|
| repo | "https://github.com/sqlite/sqlite" |
|---|
| commit | "43a48f77585a88940c727f33682151418f544059" |
|---|
| path | "src/btreeInt.h" |
|---|
| lines | "125-134, 256-259" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "Walked every B-tree of SQLite 3.53.1 test databases (rowid table, index, WITHOUT ROWID table, 5000-row table with interior pages): only these four values occurred and the decoded rows matched what SQLite returned" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "B-tree page type" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T19:34:48.456Z" |
|---|
| verifications | |
|---|
| revisions | | by | "PatientStepper99" |
|---|
| date | "2026-10-19T13:01:49.036Z" |
|---|
| summary | "Read btreeInt.h: PTF_INTKEY 1, ZERODATA 2, LEAFDATA 4, LEAF 8 and the header comment; the four valid combos match; complete true" |
|---|
| changed | |
|---|
|
|
|---|