@@ -847,6 +847,10 @@ def test_pluck_type_cast
847
847
assert_equal [ topic . approved ] , relation . pluck ( :approved )
848
848
assert_equal [ topic . last_read ] , relation . pluck ( :last_read )
849
849
assert_equal [ topic . written_on ] , relation . pluck ( :written_on )
850
+ assert_equal (
851
+ [ [ topic . written_on , topic . replies_count ] ] ,
852
+ relation . pluck ( "min(written_on)" , "min(replies_count)" )
853
+ )
850
854
end
851
855
852
856
def test_pluck_type_cast_with_conflict_column_names
@@ -1224,22 +1228,13 @@ def test_pluck_functions_with_alias
1224
1228
end
1225
1229
1226
1230
def test_pluck_functions_without_alias
1227
- expected = if current_adapter? ( :PostgreSQLAdapter )
1228
- # PostgreSQL returns the same name for each column in the given query, so each column is named "coalesce"
1229
- # As a result Rails cannot accurately type cast each value.
1230
- # To work around this, you should use aliases in your select statement (see test_pluck_functions_with_alias).
1231
- [
1232
- [ "1" , "The First Topic" ] , [ "2" , "The Second Topic of the day" ] ,
1233
- [ "3" , "The Third Topic of the day" ] , [ "4" , "The Fourth Topic of the day" ] ,
1234
- [ "5" , "The Fifth Topic of the day" ]
1235
- ]
1236
- else
1237
- [
1238
- [ 1 , "The First Topic" ] , [ 2 , "The Second Topic of the day" ] ,
1239
- [ 3 , "The Third Topic of the day" ] , [ 4 , "The Fourth Topic of the day" ] ,
1240
- [ 5 , "The Fifth Topic of the day" ]
1241
- ]
1242
- end
1231
+ expected = [
1232
+ [ 1 , "The First Topic" ] ,
1233
+ [ 2 , "The Second Topic of the day" ] ,
1234
+ [ 3 , "The Third Topic of the day" ] ,
1235
+ [ 4 , "The Fourth Topic of the day" ] ,
1236
+ [ 5 , "The Fifth Topic of the day" ]
1237
+ ]
1243
1238
1244
1239
assert_equal expected , Topic . order ( :id ) . pluck (
1245
1240
Arel . sql ( "COALESCE(id, 0)" ) ,
0 commit comments