Page 1 of 1

Sorting by due date causes APPLICATION ERROR #401

Posted: 04 Oct 2010, 18:31
by perkinsr
I clicked on "Due Date" to have it sort by due date and now I just get this error message. Unfortunately some of our users have done this as well today and now can't view issues.
APPLICATION ERROR #401

Database query failed. Error received from database was #1052: Column 'due_date' in order clause is ambiguous for the query: SELECT DISTINCT mantis_bug_table.*, mantis_bug_table.last_updated, mantis_bug_table.date_submitted, mantis_custom_field_string_table_4.value due_date FROM mantis_bug_text_table, mantis_project_table, mantis_bug_table LEFT JOIN mantis_bugnote_table ON mantis_bug_table.id = mantis_bugnote_table.bug_id LEFT JOIN mantis_bugnote_text_table ON mantis_bugnote_table.bugnote_text_id = mantis_bugnote_text_table.id LEFT JOIN mantis_custom_field_string_table mantis_custom_field_string_table_4 ON mantis_bug_table.id = mantis_custom_field_string_table_4.bug_id AND mantis_custom_field_string_table_4.field_id = 4 WHERE mantis_project_table.enabled = ? AND mantis_project_table.id = mantis_bug_table.project_id AND ( mantis_bug_table.project_id = 46 ) AND mantis_bug_table.bug_text_id = mantis_bug_text_table.id AND ( ( (summary LIKE ?) OR (mantis_bug_text_table.description LIKE ?) OR (mantis_bug_text_table.steps_to_reproduce LIKE ?) OR (mantis_bug_text_table.additional_information LIKE ?) OR (mantis_bugnote_text_table.note LIKE ?) ) ) ORDER BY sticky DESC, due_date DESC, mantis_bug_table.last_updated DESC, mantis_bug_table.date_submitted DESC.

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 04 Oct 2010, 18:46
by perkinsr
Just checked sorting by other columns, seems due_date is the only one that will break it.

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 05 Oct 2010, 07:06
by atrol
Which version of MantisBT do you use.
I am not able to reproduce the issue with version 1.2.3

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 05 Oct 2010, 12:58
by perkinsr
1.2.1

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 05 Oct 2010, 15:07
by atrol
If the problem still occurs after upgrading you should enter an issue for the problem.

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 04 Nov 2010, 13:17
by perkinsr
We have upgraded from 1.2.1 to 1.2.3 and are still seeing the problem. Any ideas on how to troubleshoot further?

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 04 Nov 2010, 15:36
by atrol
This part of your query seems strange to me

Code: Select all

mantis_custom_field_string_table_4.value due_date FROM 
Temporary remove all custom fields from list of your columns to see if the problem is caused by your custom fields.

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 04 Nov 2010, 17:12
by perkinsr
This only happens when we sort by our custom field "Due Date"

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 04 Nov 2010, 18:14
by atrol
So we where talking about different things.
I tried with standard field due date, your tried with your custom field due date.
This is exactly the reason for the problem: MantisBT is not able to work with custom fields which have the some name like standard fields.
Probably a bug.
So there is just a workaround at the moment by renaming your custom field.

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 08 Nov 2010, 15:06
by perkinsr
I changed it from "Due Date" to "Due-Date" but its still throwing the error on sort.

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 08 Nov 2010, 15:34
by atrol
Do you get the same error

Code: Select all

Database query failed. Error received from database was #1052: Column 'due_date' in order clause is ambiguous
or now another one?
I suggest this is caused by the "-"
See also http://www.mantisbt.org/bugs/view.php?id=12404
Maybe the best workaround is to name the field "Due Date" with two spaces between Due and Date

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 08 Nov 2010, 15:40
by partymix
Why don't you try deleting this field all together and creating a new one called Date Due and see if this works?

Re: Sorting by due date causes APPLICATION ERROR #401

Posted: 08 Nov 2010, 18:24
by perkinsr
The two spaces worked like a charm. Thanks for all your help.