The catalog is the table MSysObjects, a B+-tree whose root is always page 4, with object
identifier 2. A second copy, MSysObjectsShadow (object 3), has its root at page 24. Its rows describe every
table of the database, each table's columns, indexes and long value tree, and the catalog's own columns: the catalog has a row for itself.
Every other table's records are read with the column definitions found here.
Finding a table
- Read every leaf entry of the tree at page 4 as a record with the columns below.
- A row whose Type is 1 is a table: its Name, its object identifier (ObjidTable) and, in ColtypOrPgnoFDP, the page number of its root.
- Rows with the same ObjidTable and Type 2, 3 and 4 are that table's columns, indexes and long value tree.
- The pages of the table's tree carry the table's object identifier in their header, so a page can be traced back to its table.
The catalog's columns
The catalog is read before it can describe itself, so its columns are fixed. The fixed columns follow the 4-byte record header in this order; the catalog's own column rows all give 4 as the record offset, so the real offsets are the ones below.
| Id | Name | Type | Meaning |
|---|---|---|---|
| 1 | ObjidTable | Long | The object identifier of the table the row belongs to. |
| 2 | Type | Short | 1 table, 2 column, 3 index, 4 long value tree, 5 callback. |
| 3 | Id | Long | Table: its object identifier. Column: the column id. Index and long value tree: their own object identifier. |
| 4 | ColtypOrPgnoFDP | Long | Table, index, long value tree: the root page. Column: the column type. |
| 5 | SpaceUsage | Long | Column: the maximum size. Other rows: a size recorded for the tree. |
| 6 | Flags | Long | Column flags, index flags or table flags (below). |
| 7 | PagesOrLocale | Long | Table: initial pages. Column: the code page (1200 UTF-16, 1252 Western, 20127 ASCII). Index: the locale. |
| 8 | RootFlag | Bit | Set on a table that is a root object. |
| 9 | RecordOffset | Short | Column: where a fixed column starts in the record, counted from the record's first byte. |
| 10 | LCMapFlags | Long | Index: the string mapping flags. |
| 11 | KeyMost | Unsigned short | Index: the longest key. |
| 12 | LVChunkMax | Long | Long value tree: the largest segment. |
| 128 | Name | Text | The object's name. |
| 129 | Stats | Binary | Table statistics. |
| 130 | TemplateTable | Text | The template table a table derives its columns from. |
| 131 | DefaultValue | Binary | A column's default value. |
| 132 | KeyFldIDs | Binary | An index's key columns: four bytes each, a flags word (0) and the column id (indexes). |
| 133 – 137 | VarSegMac, ConditionalColumns, TupleLimits, Version, SortID | Binary | Index details: segment count, conditional columns, tuple limits, version and the sort order's identifier. |
| 256 – 261 | CallbackData, CallbackDependencies, SeparateLV, SpaceHints, SpaceDeferredLVHints, LocaleName | Long binary | Tagged columns, set when used. |
Template tables
A table that names a TemplateTable has all the template's columns first, with the same ids, and then its own. Windows' WebCache and Exchange create many tables from one template.
Flags
| Column flag | Name | Index flag | Name |
|---|---|---|---|
| 0x1 | fixed | 0x1 | unique |
| 0x2 | tagged | 0x2 | primary |
| 0x4 | not null | 0x4 | disallow null |
| 0x8 | version | 0x8 | ignore null |
| 0x10 | auto-increment | 0x20, 0x40 | ignore any null, ignore first null |
| 0x400 | multi-valued | 0x80 | lazy flush |
| 0x800 | escrow update | 0x100, 0x200 | empty, unversioned |
| 0x1000 | unversioned | 0x400, 0x800 | sort nulls high, unicode |
| 0x4000 | finalize | 0x1000, 0x2000 | tuples, tuple limits |
| 0x8000 | user-defined default | 0x4000, 0x8000, 0x10000 | cross product, key most, disallow truncation |
Column types (the JET_coltyp numbers) are listed with records.
Links
Reference
- Extensible Storage Engine (ESE) Database File (EDB) format – the catalog definitions and flags
- JET_COLTYP – Microsoft's column types