-
Notifications
You must be signed in to change notification settings - Fork 386
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
Invalid SQL for DB2 with limit + offset + order when order refers to a column not in the result set #606
Comments
p.s. I encountered this issue using jruby 1.7.6, activerecord 3.2.21, and activerecord-jdbc-adapter 1.3.13, running the queries against db2 10.5 |
Thanks Ben, having a reproducable test-case or piece of self-explaining AR code that does not work is best. |
@kares I've created a gist with a spec for the bug here: Please let me know if you have any questions. Thanks! |
@benissimo excellent ... thanks (might take me a while to look into it but having that spec will help a lot) ! |
…plete (see jruby#606) added a (previously) failing test-case provided by @benissimo to make sure it's implemented better if/as this gets re-introduced again ... reverts jruby@b330635 (introduced in 1.3.0)
* 1-3-stable: (31 commits) re-build jar (for1.3.14) preparing for 1.3.14 best to still have ruby 1.8 (syntax) compatibility ... as we're building the jar on 1.6.8 Fixed an undefined exception error in type_to_sql for MySQL [travis-ci] rake test_jdbc still can not connect ;( print a note when running on AR 4.2 ... as it's not fully supported! [derby] support for empty insert statements (e.g. `DbModel.create!`) on AR 4.x [db2] revert limit/offset OVER( ORDER BY ) matching as it was not complete (see #606) simplify DB2 adapter/visitor internals that handle limit/offset with ordering [db2] handle empty INSERT statement (default) VALUES in a way that works on AR 4.x tune DB2's tests to align with AR 4.x [db2] `select` return value should be the same as core AR (Array on 3.2) (fixes #607) improve missing 'postgres' role message [mysql] backport bulk change & schema-creation to be compatible with AR 4.x versions avoid potential NPE failures when extracting SQL array values using JDBC handle possible null values while extracting from XML columns (NPE fix for #615) DateTime columns are returned always as nil values. The "rescue nil" in the module ActiveRecord::ConnectionAdapters::Jdbc::TypeCast is hiding the error. [travis-ci] no -Xcext.enabled=false and no need to disable invoke-dynamic on 1.7.8 make sure we spin `ruby` that works with JRuby 9K [oracle] do not override primary= within column methods on AR 4.2 ...
@kares Thanks for following up on this! |
See my comment on b330635
for details.
In brief, that commit introduced a limitation on ordering. Prior to that commit, you could join on another table and sort by the joined table's column(s) even if they weren't included in your result set. With that commit, doing so results in invalid SQL.
The text was updated successfully, but these errors were encountered: