Replies: 1 comment
A real-world SQLite fixture, and what it cost before it was fixedThis thread asks for adversarial and real-world fixtures. Here is one that came out of adopting The patternSQLite has no -- schema/001_init.sql
CREATE TABLE events (id TEXT PRIMARY KEY, url TEXT NOT NULL DEFAULT '');
CREATE TABLE visitors (id TEXT PRIMARY KEY);-- schema/002_backfill.sql
-- Idempotent back-fill. SQLite has no ADD COLUMN IF NOT EXISTS, so the caller
-- discards the error deliberately: in Go this is literally `_, _ = db.Exec(stmt)`.
ALTER TABLE events ADD COLUMN url TEXT NOT NULL DEFAULT '';
What SpecSync did with it, using regex-free
|
| observation | diagnosis |
|---|---|
visitors also reported missing |
the parse aborted and the result cascaded |
only events reported |
a single, local, correct error |
Without an unrelated table in the file, both defects look like one message about events and you cannot tell a cascade from a legitimate complaint. If you are cutting a parser fixture for this thread, include at least one declaration that the suspect construct cannot possibly affect. It costs one line and it is the difference between a report and a measurement.
Two defects, one cause
get_schema_table_namesconverted a failed schema replay into an empty table set, and the caller read empty as proof of absence. One unparseable migration therefore reported everydb_tablesentry as missing. The error was not even inspected:Err(_) => return HashSet::new().- The
AddColumnarm accepted a duplicate only whenif_not_existswas set, a branch a SQLite author can never reach, because the dialect has no such syntax.
The first is the recurring shape of this release: a category is empty for want of input, and the code reads it as a verdict.
What shipped in rc.4
- An unreadable schema now degrades to unknown rather than absent, and reports only its own parse error.
- An
ADD COLUMNthat agrees with the existing column is a no-op. One that contradicts it still fails, and now names both types.
Preserved and pinned by test: a genuinely missing table still errors, a TEXT then INTEGER redeclaration is still fatal, and an ALTER on a table that does not exist reports only that.
Still open on #672, and this is the better fixture request
The same schema written as embedded DDL rather than .sql files still fails:
Supported DDL starts before the previous statement terminates
(src/schema.rs:561.) It is triggered by statements written as single-statement string literals without trailing semicolons, which is entirely valid for db.Exec and is how most Go and TypeScript projects embed their schema. That half of #672 is unfixed.
If you embed DDL in application code, this thread is the right place for a minimal snippet. The useful ones are:
- statements as separate string constants with no terminators
- a slice or array of statements executed in a loop
- dialect idioms whose only correct form looks like a contradiction to a parser, the way the idempotent
ADD COLUMNback-fill does
Please include the language and version, the exact db_tables frontmatter, and whether schema_dir is set, since that last one selects an entirely different code path (see #684, fixed in rc.5).
Uh oh!
There was an error while loading. Please reload this page.
Request a new language parser or an improvement to an existing one here. Please include the language/version, a minimal public source snippet, the expected exported symbols, the actual SpecSync result, and whether regex or AST mode was used. Adversarial and real-world fixtures are especially useful.
All reactions