aboutsummaryrefslogtreecommitdiffstats
path: root/test/visitors/test_oracle.rb
diff options
context:
space:
mode:
authorChris Dinger <ding0057@umn.edu>2012-07-14 00:24:09 -0500
committerTamir Duberstein <tamird@squareup.com>2014-09-16 07:19:03 -0700
commitfb7532795b060fe409cbb731895ef8bd9a6449d8 (patch)
tree00091d3b8716e6bbc8685722acfcea42f705de1e /test/visitors/test_oracle.rb
parent016bce4ef10eac48fab44205dcf7961e5b0bc094 (diff)
downloadrails-fb7532795b060fe409cbb731895ef8bd9a6449d8.tar.gz
rails-fb7532795b060fe409cbb731895ef8bd9a6449d8.tar.bz2
rails-fb7532795b060fe409cbb731895ef8bd9a6449d8.zip
Wrap group_by sql with a subquery for limiting rows in Oracle.
Fixes #128
Diffstat (limited to 'test/visitors/test_oracle.rb')
-rw-r--r--test/visitors/test_oracle.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/visitors/test_oracle.rb b/test/visitors/test_oracle.rb
index 9111a266cf..29d7042084 100644
--- a/test/visitors/test_oracle.rb
+++ b/test/visitors/test_oracle.rb
@@ -87,6 +87,16 @@ module Arel
}
end
+ it 'creates a subquery when there is group by' do
+ stmt = Nodes::SelectStatement.new
+ stmt.cores.first.groups << Nodes::SqlLiteral.new('foo')
+ stmt.limit = Nodes::Limit.new(10)
+ sql = compile stmt
+ sql.must_be_like %{
+ SELECT * FROM (SELECT GROUP BY foo ) WHERE ROWNUM <= 10
+ }
+ end
+
it 'creates a subquery when there is DISTINCT' do
stmt = Nodes::SelectStatement.new
stmt.cores.first.set_quantifier = Arel::Nodes::Distinct.new