-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oracle visitor gets undefined method `to_i' for #<Arel::Nodes::BindParam:0x00000002c92910> #438
Comments
Here is a test case to reproduce. https://gist.github.com/yahonda/f4bcb0fd1701c4620972eb5b38bd4498 It needs Oracle database , here is a step to create rails-dev-box running Oracle database.
|
+1 please fix |
It's seems it's happen because of this commit: Since commit above Arel have no access to limit and offset values, now it's just BindParam without any value, so oracle visitor can't calculate rawnum value here - https://github.com/rails/arel/blob/master/lib/arel/visitors/oracle.rb#L30 When i tried to solve this problem i doesn't found a way to calculate rawnum in SQL with liimit binding.
But i can't bind one variable to two same placeholder, because |
@rootatdarkstar did you get your fix to work? I'm running into the exact same problem here, with this setup:
Edit: I tried your "solution", and got this query generated:
And the values bound to these parameters seem to add up, considering this is SQL for the first page of a query limited to 10 records each.
However, that didn't return any results, and it's because your placeholder is in the wrong parameter. It should be using the offset instead of limit for the This is my hacked |
I feel like my solution fixes this issue, but I still need to run the test suite and actually test it. I could create a PR for this, but I feel this code isn't very good and that there's a better solution somewhere. What do you guys think? |
Thanks for finding a fix. It would be appreciated if you to open a pull request even if it is not "best" solution. Then arel committers can review it and it can be merged. |
rails/arel@8813ad8 Also Refer rails/arel#450 rails/arel#438 rsim#848 This fix itself has been available since Arel 7.1.3 but the latest version of Arel is 7.1.4.
The original issue has been reported rsim/oracle-enhanced#848
I need help from Arel developers then opened another issue here.
This Rails application code should generates the sql statement below, but actually it gets undefined method `to_i' for #Arel::Nodes::BindParam:0x00000002c92910
Taking a look at Arel code and existing test case which works fine, but somehow
offset.expr.to_i
does not work anymore.This issue does not reproduce with Oracle 12c database since it uses another visitor named
Oracle12
.The text was updated successfully, but these errors were encountered: