aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/visitors/oracle.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/arel/visitors/oracle.rb')
-rw-r--r--lib/arel/visitors/oracle.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb
index c691ce294e..212c18ada4 100644
--- a/lib/arel/visitors/oracle.rb
+++ b/lib/arel/visitors/oracle.rb
@@ -40,6 +40,20 @@ module Arel
return "SELECT * FROM (#{super(o)}) WHERE ROWNUM <= #{limit}"
end
+ if o.offset
+ o = o.dup
+ offset = o.offset
+ o.offset = nil
+ sql = super(o)
+ return <<-eosql
+ SELECT * FROM (
+ SELECT raw_sql_.*, rownum raw_rnum_
+ FROM (#{sql}) raw_sql_
+ )
+ WHERE #{visit offset}
+ eosql
+ end
+
super
end