Repository navigation
feat(engine): type a .sql file of any one statement - #26
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
ℹ️ No critical issues. Two small things inline.
Reviewed changes
I reviewed the whole of the single commit, which makes any single non-query statement a typed "command" on all three databases.
- Core statement classification:
lex::one_statementnow returnsStatement::QueryorStatement::Command(first_word)instead of refusing.refused_commandadds the exclude-from-type-check advice to any database error on a command. - Postgres commands: a statement that
analyze.rscan't read goes to the newEngine::command. It types from the describe alone with every column nullable, and putsreylo1on a placeholder the server doesn't bind.COPY … FROM STDINandCOPY … TO STDOUTare refused before 8000 any round trip. - MySQL commands: these are typed from the prepare.
CALLis still refused, and so is a command inMAY_RETURN_ROWS(such asEXPLAIN) whose prepare describes no columns. - SQLite commands: these are typed from the embedded SQLite's prepare against the replayed schema, with every column
unknownand nullable. reylo generate:NOT_A_QUERYnow skips any file whose diagnostic carries the exclude-from-type-check advice.- Oracle, lab, docs and tests: new
commandsandsqlite_commandscases, a re-blessedmysql_statements,pg-formstyped and untyped forms, updated per-dialect "One statement per file" docs, and a SQLite loader test.
claude-opus-5-5 | 𝕏
1a9f5e7 to
29a9cfd
Compare
There was a problem hiding this comment.
✅ No new issues found. Both earlier points are addressed.
Reviewed changes
I reviewed the two commits pushed since the last pullfrog review.
- Narrowed
reylo generateskipping:NOT_A_QUERYinsrc/cli.tsnow matches only the sharedlex::several_statements()message and Postgres'scannot insert multiple commands into a prepared statement. So if the database refuses a single command,generateprints the error and fails instead of skipping it as a migration.tests/cli.test.tscovers a command that types, a command SQLite refuses (the message includes the exclude advice) and two migrations of several statements that are still skipped. - Removed the orphaned doc line: deleted the leftover
KINDSdoc comment inengine/postgres/src/postgres.rsand rebuilt the three engine artifacts.
claude-opus-5-5 | 𝕏
bf672f8 to
43b8690
Compare
There was a problem hiding this comment.
ℹ️ No critical issues. One small docs gap is inline.
Reviewed changes
Since the last pullfrog review, the branch was rebased onto main (28aeadf). According to the range-diff, the only changes since then are in the docs, plus a new commit that rebuilds the artifacts.
- Rewrote the per-dialect docs bullet:
mainremoved the old "One statement per file" bullet. The PR now adds a "Statements other than queries" bullet topostgres.mdx,mysql.mdxandsqlite.mdx, written inmain's new plain style. - Rebuilt the engine artifacts on
main: all threeengine.wasmfiles passtests/fingerprint.test.tsagainst the rebased sources.
claude-opus-5-5 | 𝕏
a887c83 to
3f71406
Compare
3f71406 to
2947882
Compare

A
.sqlfile may now hold one statement of any kind. Aselect,insert,update,delete,merge,replace,valuesortableis analyzed as before. Any other statement (DDL, a session setting,explain,show,pragma,callon Postgres) is a command, typed from the database's own describe:cardinality: "none", so.run()isPromise<void>) where the database describes no columns;Row[]where it returns rows, every column nullable, since nothing says where a column comes from (SQLite's areunknown, as its prepare declares no type);explain,callandcreate table … astake any, and a placeholder in another command is an error at the placeholder.Until now each of these was error
reylo10. A file of several statements still is, and its message still says how to leave a migration out of the type check.What stays refused, each with its reason:
copy … from stdinandcopy … to stdout, which move data through the connection outside a statement's rows.call, and a command that may return rows (explain,analyze,check, …) whose prepare describes no columns: MySQL's prepare ofexplaindescribes none and the run returns twelve. Statements MySQL cannot prepare (start transaction,lock tables,use) keep the server's own error.A database error on a command carries the advice to exclude migrations, since a migration's
create tablefails against a schema that already has the table on SQLite, andreylo generateskips such files as it skipped migrations before.Verification
cargo testfor the four engine crates, with unit tests for the command path in core and on Postgres.commands(Postgres) andsqlite_commands, andmysql_statementsre-blessed, its DDL,set,do,show tablesanddescribenow typed and checked against what the server returns.tests/analyze.test.ts: a SQLitecreate indexis typednoneand runs through.run(), apragmareturns its rows, and acreate tableof an existing table is SQLite's error with the advice.lab/pg-forms: adoblock and anexplainare typed forms now, their types pinned like the others';untyped/holds what is still refused (acopyfromstdin, a placeholder in DDL, a parameter written twice), its errors listed inexpected.txt.pg, postgres.js and mysql2: DDL resolves toundefined;explain,showandshow tablesreturn their rows.