From 16b27be2d041ad3f5464b7e485f99e3adca898e1 Mon Sep 17 00:00:00 2001 From: rxu Date: Fri, 25 Mar 2022 20:58:36 +0700 Subject: [PATCH] [ticket/16976] Fix search results count for PostgreSQL PHPBB3-16976 --- phpBB/phpbb/search/fulltext_postgres.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index a0bb6242ec..7bbdda3bbc 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -550,7 +550,7 @@ class fulltext_postgres extends \phpbb\search\base // if the total result count is not cached yet, retrieve it from the db if (!$result_count) { - $sql_count = "SELECT COUNT(*) as result_count + $sql_count = "SELECT COUNT(DISTINCT " . (($type == 'posts') ? 'p.post_id' : 't.topic_id') . ") as result_count $sql_from $sql_where"; $result = $this->db->sql_query($sql_count);