diff options
author | Vladimir Kochnev <hashtable@yandex.ru> | 2018-09-25 14:54:03 +0400 |
---|---|---|
committer | Vladimir Kochnev <hashtable@yandex.ru> | 2018-09-25 15:39:14 +0400 |
commit | 41b92914f89be855cc6af768f13fd5fc53c967fa (patch) | |
tree | 7ee8310a3727a51a8a7f5e2bcf95427488930057 /activerecord/lib/arel/nodes | |
parent | 4f3eb86ffec8ebc4faea3143dda8ebb5aad74d08 (diff) | |
download | rails-41b92914f89be855cc6af768f13fd5fc53c967fa.tar.gz rails-41b92914f89be855cc6af768f13fd5fc53c967fa.tar.bz2 rails-41b92914f89be855cc6af768f13fd5fc53c967fa.zip |
Abandon TOP support.
Initially, `TOP` was introduced to support `limit` for MSSQL database.
Unlike PostgreSQL/MySQL/SQLite, MSSQL does not have native `LIMIT`/`OFFSET` support.
The commit adding `TOP` is 1a246f71616cf246a75ef6cbdb56032e43d4e643.
However, it figured out that `TOP` implementation was weak and it's not sufficient
to also support `OFFSET`, then `TOP` was substituted with
`ROW_NUMBER()` subquery in be48ed3071fd6524d0145c4ad3faeb4aafe3eda3.
This is a well known trick in MSSQL -
https://stackoverflow.com/questions/2135418/equivalent-of-limit-and-offset-for-sql-server.
So now we don't need this `visit_Arel_Nodes_Top` at all.
It does nothing useful but also adds an extra space after `SELECT` when `LIMIT` is being
used for **any** database.
Diffstat (limited to 'activerecord/lib/arel/nodes')
-rw-r--r-- | activerecord/lib/arel/nodes/select_core.rb | 6 | ||||
-rw-r--r-- | activerecord/lib/arel/nodes/unary.rb | 1 |
2 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/arel/nodes/select_core.rb b/activerecord/lib/arel/nodes/select_core.rb index 2defe61974..73461ff683 100644 --- a/activerecord/lib/arel/nodes/select_core.rb +++ b/activerecord/lib/arel/nodes/select_core.rb @@ -3,13 +3,12 @@ module Arel # :nodoc: all module Nodes class SelectCore < Arel::Nodes::Node - attr_accessor :top, :projections, :wheres, :groups, :windows + attr_accessor :projections, :wheres, :groups, :windows attr_accessor :havings, :source, :set_quantifier def initialize super() @source = JoinSource.new nil - @top = nil # https://ronsavage.github.io/SQL/sql-92.bnf.html#set%20quantifier @set_quantifier = nil @@ -43,7 +42,7 @@ module Arel # :nodoc: all def hash [ - @source, @top, @set_quantifier, @projections, + @source, @set_quantifier, @projections, @wheres, @groups, @havings, @windows ].hash end @@ -51,7 +50,6 @@ module Arel # :nodoc: all def eql?(other) self.class == other.class && self.source == other.source && - self.top == other.top && self.set_quantifier == other.set_quantifier && self.projections == other.projections && self.wheres == other.wheres && diff --git a/activerecord/lib/arel/nodes/unary.rb b/activerecord/lib/arel/nodes/unary.rb index a3c0045897..00639304e4 100644 --- a/activerecord/lib/arel/nodes/unary.rb +++ b/activerecord/lib/arel/nodes/unary.rb @@ -37,7 +37,6 @@ module Arel # :nodoc: all On Ordering RollUp - Top }.each do |name| const_set(name, Class.new(Unary)) end |