View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0013228 | mantisbt | time tracking | public | 2011-08-09 15:54 | 2014-09-23 18:05 |
Reporter | hartois | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.6 | ||||
Target Version | 1.2.7 | Fixed in Version | 1.2.7 | ||
Summary | 0013228: APPLICATION ERROR 0000401 Bug in SQL query in bugnote_api.php | ||||
Description | On Mantis 1.2.6 with Postgresql 9.0.4 DB | ||||
Additional Information | Patch to fix attached | ||||
Tags | patch | ||||
Attached Files | mantis-1.2.7-bugnote_api.patch (735 bytes)
diff -urN mantis.old/core/bugnote_api.php mantis.new/core/bugnote_api.php --- mantis.old/core/bugnote_api.php 2011-07-26 16:49:10.000000000 +0300 +++ mantis.new/core/bugnote_api.php 2011-08-09 22:34:25.000000000 +0300 @@ -675,7 +675,7 @@ FROM $t_user_table u, $t_bugnote_table bn, $t_bug_table b WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id $t_project_where $t_from_where $t_to_where - GROUP BY bn.bug_id, u.id, u.username, b.summary + GROUP BY bn.bug_id, u.id, u.username, b.summary, u.realname ORDER BY bn.bug_id"; $result = db_query( $query ); mantis-bugnote_api.patch (780 bytes)
--- mantis.old/core/bugnote_api.php 2011-07-26 16:49:10.000000000 +0300 +++ mantis/core/bugnote_api.php 2011-08-10 09:33:16.000000000 +0300 @@ -614,7 +614,7 @@ WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = '$c_bug_id' $t_from_where $t_to_where - GROUP BY u.id, u.username"; + GROUP BY u.id, u.username, u.realname"; $result = db_query( $query ); @@ -675,7 +675,7 @@ FROM $t_user_table u, $t_bugnote_table bn, $t_bug_table b WHERE u.id = bn.reporter_id AND bn.time_tracking != 0 AND bn.bug_id = b.id $t_project_where $t_from_where $t_to_where - GROUP BY bn.bug_id, u.id, u.username, b.summary + GROUP BY bn.bug_id, u.id, u.username, b.summary, u.realname ORDER BY bn.bug_id"; $result = db_query( $query ); | ||||
mantis-bugnote_api.patch contains more odim fix in the same file |
|
Fix committed. Thanks for the bug report ! |
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
MantisBT: master 96532dbe 2011-08-10 00:10 Details Diff |
Fix 0013228: SQL error in bugnote_api.php with PostgreSQL ERROR: column "u.realname" must appear in the GROUP BY clause or be used in an aggregate function Bug was introduced in release 1.2.6, commit c4c0a01e1f715aea775a36d3a6c7bc8bd74b5b8b. A new column was added to 2 SQL statements' SELECT clause, but the GROUP BY was not updated to match. This passed testing, as MySQL is more (too?) permissive and allows the SELECT clause to refer to ungrouped columns that are not in aggregate functions. This commit also removes unnecessary "u.id" column from the group by clause. |
Affected Issues 0013228 |
|
mod - core/bugnote_api.php | Diff File | ||
MantisBT: master-1.2.x c6ab7a0c 2011-08-10 00:10 Details Diff |
Fix 0013228: SQL error in bugnote_api.php with PostgreSQL ERROR: column "u.realname" must appear in the GROUP BY clause or be used in an aggregate function Bug was introduced in release 1.2.6, commit c4c0a01e1f715aea775a36d3a6c7bc8bd74b5b8b. A new column was added to 2 SQL statements' SELECT clause, but the GROUP BY was not updated to match. This passed testing, as MySQL is more (too?) permissive and allows the SELECT clause to refer to ungrouped columns that are not in aggregate functions. This commit also removes unnecessary "u.id" column from the group by clause. |
Affected Issues 0013228 |
|
mod - core/bugnote_api.php | Diff File |