Skip to content

Unsupported PRAGMAs are no-ops #1846

Description

@timsehn

DoltLite accepts every PRAGMA that configures the pager, the journal, or the
on-disk layout, and then ignores it. The value never changes and no error is
raised. This follows SQLite's own convention — SQLite silently accepts unknown
pragmas and unsupported values rather than erroring — but it means a caller
cannot tell that the setting did nothing.

The dividing line is DoltLite's architecture: everything above btree.h is
upstream SQLite and works unchanged, so connection-level pragmas behave
normally. Everything below it is the prolly chunk store, which has no pages, no
freelist, no rollback journal and no -wal/-shm sidecars, so pragmas
describing those have nothing to configure.

Verified by setting each pragma on a brand-new database and reading it back,
against stock SQLite for comparison.

Silently accepted, no effect

PRAGMA DoltLite always reports Stock
journal_mode wal honours delete/memory/off/…
auto_vacuum 0 2 when set before creation
secure_delete 0 1
journal_size_limit -1 32768
mmap_size 0 1048576
encoding UTF-8 UTF-16le (see #1838)
writable_schema 0 1

page_size is a special case: DoltLite accepts it and reports the new value,
so it looks honoured while meaning nothing — the store has no pages.

Readable, but synthetic

page_count (chunk count, not file pages), freelist_count (always 0),
schema_version (hash-derived, not a counter), data_version.
lock_status and stats exist only in SQLITE_TEST builds and report
chunk-store internals that have no page-level equivalent.

Explicitly rejected

wal_checkpoint(FULL|RESTART|TRUNCATE) is the one pragma that errors rather
than no-oping: "wal_checkpoint mode is not configurable on doltlite-format
databases; use the default (PASSIVE) form".

Supported, behaves as stock

locking_mode, cache_size, max_page_count, read_uncommitted,
synchronous, temp_store, foreign_keys, recursive_triggers,
legacy_alter_table, ignore_check_constraints, automatic_index,
query_only, defer_foreign_keys, cell_size_check,
reverse_unordered_selects, analysis_limit, threads, busy_timeout,
wal_autocheckpoint, application_id, user_version, fullfsync,
checkpoint_fullfsync, trusted_schema, integrity_check, quick_check,
and the schema-introspection pragmas (table_info, index_info, …).

Why this issue exists

These no-ops account for a large share of the inherited testfixture divergence
list, which currently attributes them one file at a time. Mentions of these
pragma names across known_testfixture_divergences.txt and
known_testfixture_crashes.txt: journal_mode 197, page_count 83, stats
48, auto_vacuum 47, page_size 34, lock_status 34, wal_checkpoint 28,
encoding 24, locking_mode 14, freelist_count 13, incremental_vacuum 10,
writable_schema 9, secure_delete 8, mmap_size 4.

This is the anchor those gates can cite instead of restating the reason per
suite.

Open question: should the no-ops be visible?

Two of the failure classes this causes are not cosmetic:

  • pager4 asserts that journal mode decides whether writing to a renamed
    database is allowed (OFF/MEMORY succeed, DELETE/TRUNCATE/PERSIST
    return SQLITE_READONLY). DoltLite has one behaviour for all of them, so at
    least two of those assertions can never pass while journal_mode is a no-op.
    Making journal_mode report memory — which is the closest match, since
    DoltLite keeps its log inside the single file and creates no sidecar — would
    let the OFF/MEMORY cases pass honestly.
  • A caller that sets secure_delete=1 or journal_size_limit for durability or
    disk-usage reasons gets silence, not a diagnostic.

Worth deciding whether these should stay silent (SQLite-compatible), start
reporting the mode DoltLite actually implements, or warn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions