diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-21 14:47:44 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-21 14:47:44 -0700 |
commit | 2767d4a7877a88ae50546530a630dded95ccc396 (patch) | |
tree | dcc90ddcfdc6a3230e092e86dd4ed77b4f417eb3 /lib/arel | |
parent | b64c886483e3ad2dc92bf54510cd481f9124fb69 (diff) | |
parent | 51f5bece0867316d035d5d8eeb3a2eb44cf89ad1 (diff) | |
download | rails-2767d4a7877a88ae50546530a630dded95ccc396.tar.gz rails-2767d4a7877a88ae50546530a630dded95ccc396.tar.bz2 rails-2767d4a7877a88ae50546530a630dded95ccc396.zip |
Merge pull request #211 from yahonda/support_columns_for_distinct_oracle
Support `columns_for_distinct` with Oracle adapter
Diffstat (limited to 'lib/arel')
-rw-r--r-- | lib/arel/visitors/oracle.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/arel/visitors/oracle.rb b/lib/arel/visitors/oracle.rb index b58d7338ef..b6f7b4cc3c 100644 --- a/lib/arel/visitors/oracle.rb +++ b/lib/arel/visitors/oracle.rb @@ -8,7 +8,7 @@ module Arel # if need to select first records without ORDER BY and GROUP BY and without DISTINCT # then can use simple ROWNUM in WHERE clause - if o.limit && o.orders.empty? && !o.offset && o.cores.first.projections.first !~ /^DISTINCT / + if o.limit && o.orders.empty? && !o.offset && o.cores.first.set_quantifier.class.to_s !~ /Distinct/ o.cores.last.wheres.push Nodes::LessThanOrEqual.new( Nodes::SqlLiteral.new('ROWNUM'), o.limit.expr ) @@ -83,7 +83,7 @@ module Arel return o if o.orders.empty? return o unless o.cores.any? do |core| core.projections.any? do |projection| - /DISTINCT.*FIRST_VALUE/ === projection + /FIRST_VALUE/ === projection end end # Previous version with join and split broke ORDER BY clause |