Repository navigation
Avoid false statement splits in skipped SQL tails - #9
Merged
Merged
Conversation
Keep character-level skipping lenient while respecting quoted and commented semicolons. Reuse the existing escape and comment rules without validating skipped tokens or changing partial DDL acceptance.
The lexer could return an error after consuming a bracket opener or entering a malformed HEX literal. Keep that delimiter until recovery finishes the construct, so following statements remain visible. Cover bracket tails, EXPLAIN, ParseNext recovery and Reader buffer boundaries. Treat an unterminated HEX literal like other unclosed quotes.
Verify that EXPLAIN and CREATE INDEX containing quoted semicolons each retain one original statement. Consumers enforcing one statement per query pattern must not mistake these inputs for batches.
Malformed HEX cannot be a valid single SQLite statement, so special recovery does not help avoid false rejections. Remove its state and fixtures, and restore the existing ParseNext error continuation check. Keep consumed-bracket recovery for valid SQLite identifiers.
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.
In skipped CREATE INDEX/EXPLAIN tails and error recovery, semicolons inside quoted strings, [bracket] identifiers or comments no longer end the statement. CovenantSQL/CovenantSQL#452 rejected
EXPLAIN SELECT 'a;select 2 --'as two statements. Keep character-level skipping and partial-DDL fallback.Remaining SQLite boundary differences, not addressed here:
$,@,:or#, e.g.$p(;...));EXPLAIN CREATE TRIGGER ... BEGIN ...; END; input after NUL; empty statements or trailing comments after an EXPLAIN's terminating semicolon.#ptreated as a comment; parameter suffixes containing a quote, a[or a comment opener (e.g.$p([),$p("),$p(--)); non-default backslash-escape mode.CovenantSQL/CovenantSQL#452 with go-sqlite3-encrypt v1.13.0 fails closed on these differences through its one-statement checks and SingleStatement driver mode.
Testing
linux/amd64, Go 1.27.3:
go build ./...,go vet ./...,go test -count=1 ./..., andmake -B sql.go(byte-identical) pass. The two single-statement and boundary/slice regressions fail on master; Parse/leniency assertions are compatibility guards.Current CovenantSQL develop passes
go build -tags 'linux sqlite_omit_load_extension sqlite_omit_localtime' ./...andgo test -count=1 -tags 'linux sqlite_omit_load_extension sqlite_omit_localtime' ./xenomint/...with a parser replace, including valid-statement execution and driver rejection checks.