From a265d4b29cf9c1be84603ec53a6f8b17b53321a9 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 19 Jul 2017 18:10:04 +0900 Subject: Fix `COUNT(DISTINCT ...)` with `ORDER BY` and `LIMIT` Since #26972, `ORDER BY` is kept if `LIMIT` is presented for performance. But in most SQL servers (e.g. PostgreSQL, SQL Server, etc), `ORDER BY` expressions must appear in select list for `SELECT DISTINCT`. We should not replace existing select list in that case. --- activerecord/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/CHANGELOG.md') diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md index ea9f860b95..afc459ef68 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Fix `COUNT(DISTINCT ...)` with `ORDER BY` and `LIMIT` to keep the existing select list. + + *Ryuta Kamizono* + * When a `has_one` association is destroyed by `dependent: destroy`, `destroyed_by_association` will now be set to the reflection, matching the behaviour of `has_many` associations. -- cgit v1.2.3