mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix test failures caused by #20884
PostgreSQL is strict about the usage of `DISTINCT` and `ORDER BY`, which one of the tests demonstrated. The order clause is never going to be relevant in the query we're performing, so let's just remove it entirely.
This commit is contained in:
parent
cc10911199
commit
722abe1722
1 changed files with 3 additions and 1 deletions
|
@ -12,7 +12,9 @@ module ActiveRecord
|
|||
column_type = type_for_attribute(timestamp_column.to_s)
|
||||
column = "#{connection.quote_table_name(collection.table_name)}.#{connection.quote_column_name(timestamp_column)}"
|
||||
|
||||
query = collection.select("COUNT(*) AS size", "MAX(#{column}) AS timestamp")
|
||||
query = collection
|
||||
.select("COUNT(*) AS size", "MAX(#{column}) AS timestamp")
|
||||
.unscope(:order)
|
||||
result = connection.select_one(query)
|
||||
|
||||
size = result["size"]
|
||||
|
|
Loading…
Reference in a new issue