Repository navigation
fix(sqlite): recognize single statements with SQLite parser - #45
Merged
Merged
Conversation
fffonion
force-pushed
the
fix/sqlite-single-statement-triggers
branch
from
November 23, 2026 11:30
b866e2f to
5379463
Compare
fffonion
added a commit
to rustscript-lang/rustscript-agent
that referenced
this pull request
Nov 24, 2026
The pinned Core lexer treated a trigger body's semicolons as separate statements, so legal CREATE TRIGGER DDL was refused on every route. rustscript-lang/rustscript#45 replaces that lexical boundary check with a parse-time probe; pin to its head (5379463) until it merges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
normalized_sqldecided statement boundaries by counting semicolons, so anyCREATE TRIGGER ... BEGIN ...; ENDbody looked like multiple statements and thehost rejected legal trigger DDL before it ever reached SQLite.
This rebases the dangling
b5066ddwork onto currentmasterand replaces thatlexical boundary check with a parse-time probe:
check_single_statementprepares exactly one statement on the executingconnection (same authorizer, limits and progress handler), finalizes it without
stepping, and then allows only whitespace or complete comments after the parsed
statement. A second statement now fails as
MultipleStatement, whichsqlite_errormaps back to the existingmultiple SQLite statements are not allowedmessage on every route.
normalized_sqlkeeps its lexical safety checks (quotes, comments, NUL, size) butno longer treats
;as a statement terminator; bracket-quoted identifiers arehandled like the other quote forms.
CreateTriggerand the trigger body's own DML/read actions through its defaultallow, while
Attach/Detach/Pragma/virtual-table/load_extensiondenials areuntouched.
Tests
builtins::runtime::sqlite::tests::*with--features sqlite(12 passed), including twonew cases:
single_statement_gate_accepts_trigger_bodies_and_rejects_tails— trigger bodiesparse, trailing whitespace/comments are accepted, and a second statement or DDL
after the trigger is still
MultipleStatement.trigger_body_executes_and_bumps_the_stored_revision— the gatedexecutepathcreates a second trigger and an insert fires both.
cargo +1.99.1 fmt --all -- --checkandcargo +1.99.1 clippy --locked --features sqlite --lib -- -D warningsare clean.The original commit also carried
tests/sqlite_single_statement_tests.rs; that filepredates the current typed
SqliteOpenOptions/Optiondialect, so it is omitted hererather than merged as a failing file. Trigger coverage lands in the module tests above.