Repository navigation
feat(analysis): bind column = ANY placeholders as typed lists - #60
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
Queries can now filter by a list of values with PostgreSQL's
column = ANY($1), the idiomatic alternative to dynamicINexpansion. The placeholder becomes oneList<T>method parameter of the compared column's type, bound as a single server array, soWHERE id = ANY($1)generatesList<Long> id.Changes
WHEREclauses ofSELECT,UPDATE, andDELETEaccept<column> = ANY(<placeholder>)with a$Nor:nameplaceholder; the parameter is a list of the column's type, carrying its enum type and blank-padded spelling, and is named after the column (a named placeholder keeps its own name).id = ANY(:ids) OR parent_id = ANY(:ids), is one parameter bound at every position; using the same name as both a list and a scalar is rejected as conflicting types.ANY($1::bigint[]),ANY(CAST($1 AS bigint[])), orANY(:ids::bigint[])stays typed by its cast and is now named after the compared column.BYTEA,JSON, orJSONBcolumn is rejected with a clear message; the array element-type rule is shared with schema parsing rather than duplicated.Scope and non-goals
=with the column on the left and an unquoted, unqualifiedANYaround exactly one placeholder is analyzed;<> ANY,SOME/ALL,ANY($1) = id,ARRAY[...]arguments, modifiers, and multiple arguments keep the existing unanalyzed-placeholder rejection.INlist expansion;ANYis not analyzed in projections,ON,HAVING, or write values.