View Issue Details

IDProjectCategoryView StatusLast Update
0026132mantisbttime trackingpublic2019-12-09 04:32
ReporterShadowKatmandu Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Target Version2.23.0Fixed in Version2.23.0 
Summary0026132: Application Error 401 when clicking Time Tracking at the bottom of a bug notes page
Description

There is a bug in core/bugnote_api.php which causes a database query error. The existing code:

$t_query = 'SELECT u.id AS user_id, username, realname, SUM(time_tracking) AS sum_time_tracking
FROM {user} u, {bugnote} bn
WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND
bn.bug_id = ' . db_param() . $t_from_where . $t_to_where .
' GROUP BY u.username, u.realname';

causes this problem. Adding ", u.id" after "u.realname" corrects the problem.

$t_query = 'SELECT u.id AS user_id, username, realname, SUM(time_tracking) AS sum_time_tracking
FROM {user} u, {bugnote} bn
WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND
bn.bug_id = ' . db_param() . $t_from_where . $t_to_where .
' GROUP BY u.username, u.realname, u.id';

Additional Information

APPLICATION ERROR 0000401

Database query failed. Error received from database was #-1: ERROR: column "u.id" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT u.id AS user_id, username, realname, SUM(time_trackin...
^ for the query: SELECT u.id AS user_id, username, realname, SUM(time_tracking) AS sum_time_tracking FROM mantis_user_table u, mantis_bugnote_table bn WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND
bn.bug_id = $1 AND bn.date_submitted >= 1554696000 AND bn.datesubmitted <= 1559793599 GROUP BY u.username, u.realname.

Please use the "Back" button in your web browser to return to the previous page. There you can correct whatever problems were identified in this error or select another action. You can also click an option from the menu bar to go directly to a new section.

TagsNo tags attached.

Activities

dregad

dregad

2019-09-12 18:33

developer   ~0062783

Thanks for the bug report.

Please note that time tracking feature is deprecated.

dregad

dregad

2019-09-12 18:40

developer   ~0062784

PR https://github.com/mantisbt/mantisbt/pull/1561

Related Changesets

MantisBT: master c57ccb2b

2019-09-12 14:38

dregad


Details Diff
Add missing column from group by clause

This causes an error when retrieving time tracking information on View
Issue Details page, on MySQL when ONLY_FULL_GROUP_BY is enabled (default
since 5.7).

Fixes 0026132
Affected Issues
0026132
mod - core/bugnote_api.php Diff File