Dependency Graph
View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0011139 | mantisbt | custom fields | public | 2009-11-09 13:25 | 2011-08-05 02:36 |
| Reporter | leowmjw | Assigned To | atrol | ||
| Priority | normal | Severity | major | Reproducibility | always |
| Status | closed | Resolution | duplicate | ||
| Platform | Apache 2, PHP 5.2.4-2ubuntu5.7 | OS | Ubuntu Linux | OS Version | 8.04 |
| Product Version | 1.2.0a3 | ||||
| Summary | 0011139: APPLICATION ERROR 0000401 - DB -> #1066: Not unique table/alias for custom_field | ||||
| Description | Tested on v1.2.0a3 but reviewed code in v1.2.0rc2 but don't see any fix yet. Description;When trying to sort and then filter a custom field of type DATE; encounter APPLICATION ERROR 0000401 which is caused by DB Error #1066: Not unique table/alias. Exception:APPLICATION ERROR 0000401 Database query failed. Error received from database was #1066: Not unique table/alias: 'mantis_custom_field_string_table_9' for the query: SELECT Count( DISTINCT mantis_bug_table.id ) as idcnt FROM mantis_project_table, mantis_bug_table LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_9 ON mantis_custom_field_string_table_9.bug_id = mantis_bug_table.id AND mantis_custom_field_string_table_9.field_id = 9 LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_6 ON mantis_custom_field_string_table_6.bug_id = mantis_bug_table.id AND mantis_custom_field_string_table_6.field_id = 6 LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_9 ON mantis_bug_table.id = mantis_custom_field_string_table_9.bug_id AND mantis_custom_field_string_table_9.field_id = 9 WHERE mantis_project_table.enabled = 1 AND mantis_project_table.id = mantis Steps:Assumption: Have Custom Field of type DATE and Custom Field can be filtered and is show in the "View Issue" page. Root Cause:Table mantis_custom_field_string_table aliased more than once in the LEFT JOIN portion. Solution:Patch for v1.2.0a3 (Ugly hack! Please suggest better alternative)diff /home/leow/SANDBOX/MANTIS/support/current/core_v1.2.0a3/filter_api.php /home/leow/SANDBOX/MANTIS/mantis12/core/filter_api.php
| ||||
| Steps To Reproduce | Steps:Assumption: Have Custom Field of type DATE and Custom Field can be filtered and is show in the "View Issue" page. | ||||
| Additional Information | Root Cause:Table mantis_custom_field_string_table aliased more than once in the LEFT JOIN portion. Solution:Patch for v1.2.0a3 (Ugly hack! Please suggest better alternative)diff /home/leow/SANDBOX/MANTIS/support/current/core_v1.2.0a3/filter_api.php /home/leow/SANDBOX/MANTIS/mantis12/core/filter_api.php
| ||||
| Tags | No tags attached. | ||||
|
Updated patch for mantisbt-1.2.0rc2-2010-01-05-master-1.2.x-67762d7 Solution:Patch for v1.2.0rc2 (Ugly hack! Please suggest better alternative)leow@leow-laptop:~/SANDBOX/MANTIS$ diff mantis12build/core/filter_api.php pokokhydro/custom/core/filter_api.php
|
|
|
I have the same problem, thanks for the workaround which helps. |
|
|
I have the same problem with the version 1.2.0 and a mysql database. |
|
|
I noticed that the two LEFT JOINs that are causing the error, were actually the same JOIN, but were structured in a different way. I managed to track down where the second JOIN was being produced and came up with the following patch: ===================================================================
|
|
|
This is a duplicate of 0005859 and not fixed yet. My patch for this problem (1.2.0 - 1.2.2) is to prevent multiple left joins: --- mantis-1.2.0/core/filter_api.php 2010-02-24 10:34:19.642476000 +0100 check to be sure this field wasn't already added to the query.
It may be better to use the table name of the joined table as a key (i. e. $p_query_clauses['join'][$t_cf_table_alias] instead of just $p_query_clauses['join'][]), but this would mean to rewrite some code in filter_get_bug_rows() (don't use array_push()). |
|
|
thanks nimmich for the hints and the patch |
|
related to
child of
duplicate of