View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0012404 | mantisbt | custom fields | public | 2010-09-27 09:00 | 2014-09-23 18:05 |
Reporter | codeslayer | Assigned To | dregad | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Target Version | 1.2.9 | Fixed in Version | 1.2.9 | ||
Summary | 0012404: custom field sort issue on view issues page | ||||
Description | When a custom field with name "w2d-defect" (see definition below) is created it can't be used for sorting on the "view issues" page. An SQL error is being thrown (and remains) when clicking on the title of the column: APPLICATION ERROR 0000401 Database query failed. Error received from database was 0001064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-defect FROM mantis_project_table, mantis_bug_table LEFT JOIN mantis_custom_fie' at line 1 for the query: SELECT DISTINCT mantis_bug_table.*, mantis_bug_table.last_updated, mantis_bug_table.date_submitted, mantis_custom_field_string_table_2.value w2d-defect FROM mantis_project_table, mantis_bug_table LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_2 ON mantis_bug_table.id = mantis_custom_field_string_table_2.bug_id AND mantis_custom_field_string_table_2.field_id = 2 WHERE mantis_project_table.enabled = ? AND mantis_project_table.id = mantis_bug_table.project_id AND ( mantis_bug_table.project_id in (1, 2) ) ORDER BY w2d-defect DESC, mantis_bug_table.last_updated DESC, mantis_bug_table.date_submitted DESC. | ||||
Steps To Reproduce |
| ||||
Additional Information | The custom field has the following definition: | ||||
Tags | No tags attached. | ||||
related to | 0015721 | closed | grangeway | Functionality to consider porting to master-2.0.x |
has duplicate | 0013541 | closed | atrol | Can't sort results by a custom field containing a '- ' in its name |
has duplicate | 0013591 | closed | atrol | Can't sort results by a custom field containing a '- ' in its name |
has duplicate | 0013660 | closed | dregad | New Custom Field (Due Date) Sort Error |
has duplicate | 0011468 | closed | atrol | can't sort custom field with date type |
has duplicate | 0008323 | closed | dregad | Spaces in custom fields |
related to | 0012680 | closed | dregad | Custom field name with paranthesis leads to db error message when sorting "view issues" |
related to | 0012170 | closed | dregad | SQL syntax error occurs when sorting it by the custom field where special character is included. |
This is caused by the "-" in name. |
|
We have same error with custom fields : "environnement" Possible values : Production|Test |
|
After updating filter_api.php; still have same problem with my custom field traitement. SELECT DISTINCT mantis_bug_table.*, mantis_custom_field_string_table_6.value custom_field_6 FROM mantis_project_table, mantis_bug_table LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_20 ON mantis_bug_table.id = mantis_custom_field_string_table_20.bug_id AND mantis_custom_field_string_table_20.field_id = 20 LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_6 ON mantis_bug_table.id = mantis_custom_field_string_table_6.bug_id AND mantis_custom_field_string_table_6.field_id = 6 WHERE mantis_project_table.enabled = 1 AND mantis_project_table.id = mantis_bug_table.project_id AND ( mantis_bug_table.project_id in (39, 48, 47, 13, 14, 43, 29, 51, 44, 15, 55, 17, 49, 45, 18, 25, 28, 19, 24, 20, 11, 57, 23, 54, 21, 12, 50, 22, 10, 16, 9, 33, 32, 31, 34, 35, 36, 37, 2, 3, 5, 7, 6, 42, 4, 1, 52, 46, 41, 30, 27, 58, 60, 59) ) AND (mantis_custom_field_string_table_20.value = 'Oui') ORDER BY mantis_bug_table.sticky DESC, custom_field_6 ASC, mantis_bug_table.last_updated DESC, mantis_bug_table.date_submitted DESC Error near custom_field_6 |
|
I have the same problem (sorting results in 0001064 MySQL error) for this custom field name: Expected QA date [not later than] This has been transformed to this (shortened) SQL statement: SELECT DISTINCT mantis_bug_table.*, This leads to the error message. If i remove the part "_[not_later_than]" on both occurances, the query runs fine. Is there any specific target release where a possibly existing fix can be tested? |
|
@M.C.S. 0012404:0031113: Please download a nightly build http://mantisbt.org/builds/ @csonnet 0012404:0030649: Did this occur on a customized Mantis ? If so, can you confirm the same error occurs on the nightly build also ? |
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
MantisBT: master 170e9397 2011-12-07 04:55 Details Diff |
Define custom field alias using id instead of name The old method of defining a custom field alias based on the field's name, generated SQL syntax error when trying to sort on that field in the view issues page, if the name contains characters not valid for an SQL identifier (e.g. '-', '(', ')', etc). Fixes 0012404, 0012680 |
Affected Issues 0012404, 0012680 |
|
mod - core/filter_api.php | Diff File | ||
MantisBT: master-1.2.x 8fb27ae7 2011-12-07 04:55 Details Diff |
Define custom field alias using id instead of name The old method of defining a custom field alias based on the field's name, generated SQL syntax error when trying to sort on that field in the view issues page, if the name contains characters not valid for an SQL identifier (e.g. '-', '(', ')', etc). Fixes 0012404, 0012680 |
Affected Issues 0012404, 0012680 |
|
mod - core/filter_api.php | Diff File |