diff options
author | kennyj <kennyj@gmail.com> | 2012-08-02 02:34:38 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-08-02 23:31:46 +0900 |
commit | f137c2b838773be3cfa916e9f7a91773b9245bda (patch) | |
tree | 35d277f0277146546f22363ff6f36a5e0e7b8d0e /activerecord/lib/active_record/connection_adapters | |
parent | a252436d64aa5d1f971e5d57b6ec177a207796e8 (diff) | |
download | rails-f137c2b838773be3cfa916e9f7a91773b9245bda.tar.gz rails-f137c2b838773be3cfa916e9f7a91773b9245bda.tar.bz2 rails-f137c2b838773be3cfa916e9f7a91773b9245bda.zip |
Backport #5168 to 3-2-stable. Fix a problem that NULLS is ignored by postgresql_adapter.rb while creating distincts.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index cd565787b3..b26f16da3a 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -1108,7 +1108,7 @@ module ActiveRecord # Construct a clean list of column names from the ORDER BY clause, removing # any ASC/DESC modifiers - order_columns = orders.collect { |s| s.gsub(/\s+(ASC|DESC)\s*/i, '') } + order_columns = orders.collect { |s| s.gsub(/\s+(ASC|DESC)\s*(NULLS\s+(FIRST|LAST)\s*)?/i, '') } order_columns.delete_if { |c| c.blank? } order_columns = order_columns.zip((0...order_columns.size).to_a).map { |s,i| "#{s} AS alias_#{i}" } |