From c6cd9a59f200863ccfe8ad1d9c5a8876c39b9c5c Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 20 Dec 2017 05:09:49 +0900 Subject: Fix `count(:all)` to correctly work `distinct` with custom SELECT list Currently `count(:all)` with `distinct` doesn't work correctly because SELECT list is always replaced to `*` or primary key in that case even if having custom SELECT list. And also, PostgreSQL has a limitation that ORDER BY expressions must appear in select list for SELECT DISTINCT. Therefore, we should not replace custom SELECT list when using `count(:all)` with `distinct`. Closes #31277. --- 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 73970c99d0..d5cce3f47c 100644 --- a/activerecord/CHANGELOG.md +++ b/activerecord/CHANGELOG.md @@ -1,3 +1,7 @@ +* Fix `count(:all)` to correctly work `distinct` with custom SELECT list. + + *Ryuta Kamizono* + * Using subselect for `delete_all` with `limit` or `offset`. *Ryuta Kamizono* -- cgit v1.2.3