Repository navigation
feat: parse SQLite INSERT OR <algorithm> with the INSERT clauses - #2924
Merged
manticore-projects merged 1 commit intoNov 14, 2026
Merged
Conversation
ItsDeadlyProgrammer
force-pushed
the
sqlite-insert-or
branch
from
November 13, 2026 10:53
73a8796 to
d47f329
Compare
Read the algorithm in Insert() behind Dialect.SQLITE, so the OR-form keeps ON CONFLICT, RETURNING, DEFAULT VALUES and the table aliases. REPLACE without OR keeps its Upsert reading. Part of JSQLParser#2852
ItsDeadlyProgrammer
force-pushed
the
sqlite-insert-or
branch
from
November 13, 2026 11:31
d47f329 to
65606b3
Compare
Contributor
|
Thank you! |
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.
The
INSERT OR <algorithm>form was parsed by the separateUpsert()production, so it rejectedthe clauses the plain
INSERTproduction supports:Change
SingleStatement()readsINSERT OR <algorithm>withInsert(), behindDialect.SQLITE.Insert()accepts[ <K_OR> algorithm=RelObjectName() ]after<K_INSERT>and stores it asInsertConflictAlgorithm(OR_ABORT,OR_FAIL,OR_IGNORE,OR_REPLACE,OR_ROLLBACK),rendered by
appendInsertPrefix();Insert.omitIntokeeps SQLite's optionalINTO.Upsert/UpsertDeParserare untouched:REPLACEwithoutORand PostgreSQL'sUPSERTparseexactly as before. Folding
REPLACEin touches callers that cast toUpsert(ReplaceTest,MySqlInsertSourceTest,ReplaceValidatorTest) and is left for a second PR.Tests
SQLiteTestgainstestInsertOrConflictAlgorithmIsAnInsert,testInsertOrKeepsTheInsertClauses(ON CONFLICT, RETURNING, DEFAULT VALUES, alias) andtestInsertOrKeepsTheOptionalInto.Full suite: 13112 tests, no new failures compared to
master;SQLiteTest41/41 green. A sweep ofall 322
.sqlfixtures insrc/test/resourcesproduces identical parse results and deparsed outputon the patched and unpatched parser.
Part of #2852.