Simple Machines Community Forum

SMF Development => Bug Reports => Topic started by: Speed King on June 25, 2025, 08:38:59 AM

Title: Database error in Search results after update to 2.1.5
Post by: Speed King on June 25, 2025, 08:38:59 AM
Hello,

Yesterday, I have updated my forum from 2.1.4 to 2.1.5
After update, when I'm using Quick Search bar, Search "In this topic", with every search query I get a database error message:

'bulataka_bnf.t.id_topic' isn't in GROUP BY
File: /home/bulataka/public_html/BNF/Sources/Search.php
Line: 1725

Click => (https://i.postimg.cc/jwJM2x3b/DBsearch.jpg) (https://postimg.cc/jwJM2x3b)


Sources/Search.php, Line 1725
$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_no_index', ($smcFunc['db_support_ignore'] ? ('
Forum details:

Forum version: SMF 2.1.5 (more detailed)
Current SMF version: SMF 2.1.5
GD version: bundled (2.1.0 compatible)
MySQL engine: MariaDB
MySQL version: 10.6.22-MariaDB-log
SMF file based caching: 2.1.5
Memcache:
Memcached:
SQLite3 database based caching: 3.26.0
PHP: 8.4.8 (more detailed)
Server version: Apache


With all previous SMF 2.1.* versions, search function worked fine.
Title: Re: Database error in Search results after update to 2.1.5
Post by: shawnb61 on June 25, 2025, 09:22:25 AM
Pretty sure this is a bug...

I'll take a peek later today.

MariaDB strikes again...   ::)
Title: Re: Database error in Search results after update to 2.1.5
Post by: shawnb61 on June 25, 2025, 02:03:49 PM
Issue logged: https://github.com/SimpleMachines/SMF/issues/8688

You can address by making the following change in Search.php, ~line 1336-1337, adding the t.id_topic:
Search:
                    if (!empty($search_params['show_complete']))
                        $main_query['group_by'][] = 'm.id_msg, t.id_first_msg, t.id_last_msg';
Replace:
                    if (!empty($search_params['show_complete']))
                        $main_query['group_by'][] = 't.id_topic, m.id_msg, t.id_first_msg, t.id_last_msg';

As ever, if you make a tweak like this in your code, you will need to revert it before applying the next patch.

This issue only affects MariaDB users.
Title: Re: Database error in Search results after update to 2.1.5
Post by: Speed King on June 25, 2025, 03:22:40 PM
 Thanks, problem solved  :)