Skip to content

fix: SELECT ... FROM sqlite_master does not compile (#707) - #719

Open
dpsiderius wants to merge 1 commit into
fix/708-rowid-in-projectionfrom
fix/707-sqlite-master-select
Open

dpsiderius wants to merge 1 commit into
fix/708-rowid-in-projectionfrom
fix/707-sqlite-master-select

Conversation

@dpsiderius

Copy link
Copy Markdown
Contributor

Stacked on #708 (fix/708-rowid-in-projection) — merge that first.

What

Route 1 chosen and recorded in ADR-0046: resolve_from_table_schema now
hands back a hardcoded TableSchema (type, name, tbl_name,
rootpage, sql) rooted at page 1 for sqlite_master/sqlite_schema.
No synthesized rows, no CLI special-casing — ordinary table-scan codegen
handles WHERE, ORDER BY, and an empty database.

Before/after

SELECT name FROM sqlite_master   -- before: unsupported: no such table
                                  -- after:  matches oracle, incl. autoindex rows

Connection::table_names() (added earlier as a workaround) is
unaffected; this closes the gap for the general SELECT path, including
index discovery the workaround couldn't reach.

Test plan

  • tests/corpus/sqlite_master_test.rs — byte-exact vs. the oracle,
    including a DB with tables + autoindexes + explicit indexes.
  • make test, make lint, make test-corpus, make check-mvl-limit, make check-mod-files, make assurance all pass.

Refs: 013/Req-3, #705, ADR-0029, ADR-0046
Closes #707

spend: matched estimate

resolve_from_table_schema (the single choke point every FROM reference
goes through) now recognizes sqlite_master/sqlite_schema and hands
back a hardcoded TableSchema rooted at page 1 with its real five-column
shape, instead of consulting the decoded catalog (which never contains
an entry describing itself). Everything downstream — WHERE, ORDER BY,
an empty database — falls out of the ordinary table-scan path for
free, matching the oracle exactly, including autoindex rows.

Route chosen (make sqlite_master a resolvable table, over adding an
API-level indexes() accessor) and recorded in ADR-0042, which
supersedes ADR-0029's problem statement for this one table only — the
other 9 CLI-layer introspection pragmas ADR-0029 covers are unaffected.

spend: roughly matched the medium estimate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: SELECT ... FROM sqlite_master does not compile — the catalog is invisible to the SELECT path

1 participant