Repository navigation
feat(analysis): accept write values that bind no placeholder - #56
Merged
Merged
Conversation
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
Common write idioms such as
updated_at = now(),version = version + 1,DEFAULT, literals, andNULLwere rejected because everyINSERTvalue andUPDATEassignment had to be a placeholder. They are now accepted as written: a value that binds no placeholder contributes no generated parameter and reaches the database unchanged, while the placeholders beside it keep their existing numbering and binding order.Changes
INSERT ... VALUESaccepts, for each column, either a placeholder or an expression that binds none; the expression's target column must exist in the table, but its type does not need a Java mapping because nothing binds it.UPDATE ... SETaccepts the same per assignment; assignment placeholders still bind beforeWHEREplaceholders, for both$Nand:namequeries.SET (name, active) = ('a', TRUE)now fails withUPDATE assignments must set one column at a time.$2 || 'x'orCOALESCE($2, bio), is rejected as a placeholder in an unsupported location.$Nand named placeholders, returning inserts, mixedUPDATEassignments, writes without any placeholder, unmapped-type target columns, unknown target columns, and the rejections; a PostgreSQL integration test generates, compiles, and runs an:execinsert, a returning named insert, and an:execupdate usingDEFAULT, a literal,NULL,now(), andcode + 1.Scope and non-goals
ON CONFLICT, multi-rowVALUES, andINSERT ... SELECTare unchanged and remain rejected.