Repository navigation
Conversation
yyssophie
marked this pull request as draft
October 20, 2026 01:15
yyssophie
marked this pull request as ready for review
October 20, 2026 01:30
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved moderate issues remain in DELETE foreign-key handling and schema parsing of constraints, quoted identifiers, and comments.
1 open issue
What changed in this PR
Fixes SQLite provider crashes and foreign-key error handling.
Changes:
- Improves schema definition parsing.
- Prevents
DELETEgeneration when no writable table exists. - Recognizes foreign-key constraint errors.
- Adds regression coverage.
| File | Summary |
|---|---|
test/sqlancer/sqlite3/TestSQLite3Errors.java |
Tests expected SQLite errors. |
test/sqlancer/sqlite3/schema/TestSQLite3Schema.java |
Tests schema parsing and views. |
test/sqlancer/sqlite3/gen/dml/TestSQLite3DeleteGenerator.java |
Tests DELETE bailout behavior. |
src/sqlancer/sqlite3/SQLite3Errors.java |
Adds foreign-key error handling. |
src/sqlancer/sqlite3/schema/SQLite3Schema.java |
Parses schema definitions safely. |
src/sqlancer/sqlite3/gen/dml/SQLite3DeleteGenerator.java |
Handles missing writable tables. |
Review effort: Lite
| */ | ||
| static List<String> splitColumnDefinitions(String sql) { | ||
| List<String> definitions = new ArrayList<>(); | ||
| int opening = sql.indexOf('('); |
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.

Summary
Fix three failure modes in the SQLite provider that were found during query-plan-guidance runs:
ArrayIndexOutOfBoundsException.getRandomTableOrBailoutwhen generatingDELETEstatements so SQLancer skips the action when no writable table is available instead of selecting from an empty list.[SQLITE_CONSTRAINT_FOREIGNKEY]as an expected insert/update error instead of reporting a valid SQLite constraint failure as an assertion failure.Regression tests
ArrayIndexOutOfBoundsExceptionon the parent commit.DELETEgeneration bails out when only a view is available.Testing
mvn -q -Dtest=sqlancer.sqlite3.TestSQLite3Errors,sqlancer.sqlite3.gen.dml.TestSQLite3DeleteGenerator,sqlancer.sqlite3.schema.TestSQLite3Schema testmvn -q -DskipTests verify