issue 2797 solid cache arel binderror fix - #2809
Open
andynu wants to merge 2 commits into
Open
Conversation
`visit_Arel_Nodes_HomogeneousIn` was joining IN-list values with bare
"," instead of ", ". The whitespace is irrelevant to Oracle's parser
but breaks Solid Cache 1.0.10's `read_multi`, which composes prepared
statements via literal-string gsub against the to_sql output:
where(key_hash: [1111, 2222]).select(...).to_sql
.gsub("1111, 2222", "?, ?")
oracle-enhanced returned "IN (1111,2222)" -- gsub no-op'd, leaving
zero placeholders in the template while the caller still passed bind
values, producing Arel::BindError("wrong number of bind variables").
Aligning the separator with every other adapter (and every other
comma-joiner in oracle-enhanced itself) unblocks Solid Cache without
behavioural change for first-party AR queries.
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.
So solid cache is doing a very specific gsub:
https://github.com/rails/solid_cache/blob/4e7219c4210d165e03176439dfca99238ba6fde9/app/models/solid_cache/entry.rb#L114-L122
"1111, 2222" and the oracle adapter is not including the space, so the substitution doesn't happen, so the number of bind question marks ends up wrong.
An upstream fix to solid cache would be reasonable too, but adding a space here doesn't cost us much.
Fixes #2797