diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-05-30 11:51:14 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-05-30 11:51:14 +0200 |
commit | 6c2b569660c9216595d02ce6412e3bdcc7293317 (patch) | |
tree | e7d4ada8e9b88f2fa32278e47c82ba807d4be229 /activerecord/test | |
parent | f1eddea1e3f6faf93581c43651348f48b2b7d8bb (diff) | |
parent | 1cb52a1733e693fdc76cf92b5408c204b29edcce (diff) | |
download | rails-6c2b569660c9216595d02ce6412e3bdcc7293317.tar.gz rails-6c2b569660c9216595d02ce6412e3bdcc7293317.tar.bz2 rails-6c2b569660c9216595d02ce6412e3bdcc7293317.zip |
Merge pull request #11896 from nkondratyev/fix_pg_columns_for_distinct
Fixed #columns_for_distinct of postgresql adapter
Conflicts:
activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb | 11 |
1 files changed, 11 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 960e33b329..aaa874af7d 100644 --- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb +++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb @@ -355,6 +355,17 @@ module ActiveRecord assert_equal "posts.title, posts.updater_id AS alias_0", @connection.columns_for_distinct("posts.title", ["posts.updater_id desc nulls last"]) end + def test_columns_for_distinct_without_order_specifiers + assert_equal "posts.title, posts.updater_id AS alias_0", + @connection.columns_for_distinct("posts.title", ["posts.updater_id"]) + + assert_equal "posts.title, posts.updater_id AS alias_0", + @connection.columns_for_distinct("posts.title", ["posts.updater_id nulls last"]) + + assert_equal "posts.title, posts.updater_id AS alias_0", + @connection.columns_for_distinct("posts.title", ["posts.updater_id nulls first"]) + end + def test_raise_error_when_cannot_translate_exception assert_raise TypeError do @connection.send(:log, nil) { @connection.execute(nil) } |