Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixing oracle issue with limit and offset if query is ordered #100

Merged
merged 1 commit into from

3 participants

@tenderlove tenderlove merged commit cbdc7e7 into from
@eduardordm

This commit COMPLETELY breaks paging. It makes pagination AT LEAST 900x slower and unusable if you have a medium-large dataset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 4 deletions.
  1. +1 −2  lib/arel/visitors/oracle.rb
  2. +1 −2  test/visitors/test_oracle.rb
View
3  lib/arel/visitors/oracle.rb
@@ -25,9 +25,8 @@ def visit_Arel_Nodes_SelectStatement o
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (#{sql}) raw_sql_
- WHERE rownum <= #{offset.expr.to_i + limit}
)
- WHERE #{visit offset}
+ WHERE raw_rnum_ between #{offset.expr.to_i + 1 } and #{offset.expr.to_i + limit}
eosql
end
View
3  test/visitors/test_oracle.rb
@@ -102,9 +102,8 @@ module Visitors
SELECT * FROM (
SELECT raw_sql_.*, rownum raw_rnum_
FROM (SELECT) raw_sql_
- WHERE rownum <= 20
)
- WHERE raw_rnum_ > 10
+ WHERE raw_rnum_ between 11 and 20
}
end
Something went wrong with that request. Please try again.