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/test/cases | |
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/test/cases')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb index d57794daf8..3eb73d3093 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -179,6 +179,11 @@ module ActiveRecord assert_equal Arel.sql('$2'), bind end + def test_distinct_with_nulls + assert_equal "DISTINCT posts.title, posts.updater_id AS alias_0", @connection.distinct("posts.title", ["posts.updater_id desc nulls first"]) + assert_equal "DISTINCT posts.title, posts.updater_id AS alias_0", @connection.distinct("posts.title", ["posts.updater_id desc nulls last"]) + end + private def insert(ctx, data) binds = data.map { |name, value| |