aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorNikolay Kondratyev <nkondratyev@yandex.ru>2013-08-14 17:44:14 +0600
committerNikolay Kondratyev <nkondratyev@yandex.ru>2013-08-15 14:14:37 +0600
commit1cb52a1733e693fdc76cf92b5408c204b29edcce (patch)
tree19d0c469ff0ec9cec34075a6c24c1be27c702cfc /activerecord/test/cases
parente90f0e0eb68825b7a07e2f468272a138107154c3 (diff)
downloadrails-1cb52a1733e693fdc76cf92b5408c204b29edcce.tar.gz
rails-1cb52a1733e693fdc76cf92b5408c204b29edcce.tar.bz2
rails-1cb52a1733e693fdc76cf92b5408c204b29edcce.zip
Fixed `columns_for_distinct` of postgresql adapter
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb11
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 8b017760b1..ec1431cd6e 100644
--- a/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
@@ -259,6 +259,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) }