summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_query_builder.php2
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 2 insertions, 1 deletions
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index c862d937d..84346a6ed 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1395,7 +1395,7 @@ abstract class CI_DB_query_builder extends CI_DB_driver {
$this->qb_orderby = NULL;
}
- $result = ($this->qb_distinct === TRUE)
+ $result = ($this->qb_distinct === TRUE OR ! empty($this->qb_groupby))
? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results")
: $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows')));
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 471e78f53..27b49f915 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -31,6 +31,7 @@ Bug fixes for 3.0.7
- Fixed a bug (#4613) - :doc:`Email Library <libraries/config>` failed to send multiple emails via SMTP due to "already authenticated" errors when keep-alive is enabled.
- Fixed a bug (#4633) - :doc:`Form Validation Library <libraries/form_validation>` ignored multiple "callback" rules for empty, non-required fields.
- Fixed a bug (#4637) - :doc:`Database <database/index>` method `error()` returned ``FALSE`` with the 'oci8' driver if there was no error.
+- Fixed a bug (#4647) - :doc:`Query Builder <database/query_builder>` method ``count_all_results()`` doesn't take into account ``GROUP BY`` clauses while deciding whether to do a subquery or not.
Version 3.0.6
=============