From ba487a24dcc5e53686cd0a05825ae62ea9b133f8 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 1 Nov 2021 00:51:45 +0700 Subject: [PATCH] [ticket/16902] Fix PosgreSQL author topics search results count PHPBB3-16902 --- phpBB/phpbb/search/fulltext_postgres.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 7eba463f2f..a0bb6242ec 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -836,8 +836,9 @@ class fulltext_postgres extends \phpbb\search\base GROUP BY t.topic_id, $sort_by_sql[$sort_key]"; } - $this->db->sql_query($sql_count); - $result_count = (int) $this->db->sql_fetchfield('result_count'); + $result = $this->db->sql_query($sql_count); + $result_count = ($type == 'posts') ? (int) $this->db->sql_fetchfield('result_count') : count($this->db->sql_fetchrowset($result)); + $this->db->sql_freeresult($result); if (!$result_count) {