Closed Bug 289602 Opened 20 years ago Closed 19 years ago

Ordering by "Deadline" doesn't work.

Categories

(Bugzilla :: Query/Bug List, defect)

2.19.2
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: terry, Assigned: Wurblzap)

References

Details

(Whiteboard: [blocker will fix])

If you bring up a buglist that contains the "deadline" column, and then you click on that "deadline" header to order your bugs by deadline, it crashes. Turns out the problem is that the definition of the "deadline" column works out to something that contains a comma in it. And the list of things to order by is separated by commas. So when it goes to parse out the list of columns, the comma in the middle of the deadline definition confuses things, and it blows up. I tried to look for a quick fix, but I didn't see one. Options I see include: - Change it to separate columns by something other than commas (maybe semicolons). This is probably the easiest fix, but it would break existing bookmarks. - Change the definition of deadline to be something that doesn't have a comma in it. I don't have any great ideas for what that would be. - Change the %columns data structure in buglist.cgi so that the string you put out in the URL does not have to be the same string that you feed to SQL. This is probably a somewhat large change.
Arrgh. We could also put it in %special_order_by in Search.pm, if we can even get it to get that far. This could also be solved by doing all the ORDER BY processing within Search.pm instead of doing ANY of it in buglist.
I like the last of those options best... we should be using the short name from fielddefs in anything that goes to a URL, and translate it back to the SQL fragment on the back end when processing it.
See also bug 302326.
*** Bug 312186 has been marked as a duplicate of this bug. ***
Bug 302599 seems to me to be somewhat related.
For the record, the error message which is returned: https://localhost/cvsbugzilla/buglist.cgi?bug_id=352&field-1-0-0=bug_id &query_format=advanced&type-1-0-0=anyexact&value-1-0-0=352 &order=DATE_FORMAT%28bugs.deadline%2C%20%27%25Y-%25m-%25d%27%29%20AS%20deadline,bugs.bug_id&query_based_on=Security%20Bugs The custom sort order specified in your form submission contains an invalid column name DATE_FORMAT(bugs.deadline.
Flags: blocking2.22?
Flags: blocking2.20.1?
Target Milestone: --- → Bugzilla 2.20
This should be fixed in 2.20, but I won't block the 2.20.1 release on it. However, I don't think we should release 2.22 until this is fixed.
Flags: blocking2.22?
Flags: blocking2.22+
Flags: blocking2.20.1?
Flags: blocking2.20.1-
Note that this error is generated by buglist.cgi, line 771: else { ThrowCodeError("invalid_column_name_form", $vars); } in the /^Last Changed$/ && do { ... } block. joel, any idea?
(In reply to comment #8) > in the /^Last Changed$/ && do { ... } block. err... the file and the line are correct, but it's not in this block.
OK, I found the reason, buglist.cgi list 756: # A custom list of columns. Make sure each column is valid. foreach my $fragment (split(/,/, $order)) { The order list is a comma separated list, but the deadline contains a comma and so is splitted: TO_CHAR(bugs.deadline, 'YYYY-MM-DD') AS deadline Consequently, "TO_CHAR(bugs.deadline" alone doesn't match any column name and is rejected. Note that this is the unique column name which contains a comma.
*** Bug 319993 has been marked as a duplicate of this bug. ***
My bug 31993 was against 2.20 released, i.e. yes it is still in 2.20.
I think we are doing things the wrong way. $cgi->param('order') should not contain SQL fragments, i.e. the column names of DefineColumn(), because they are DB dependent and so cannot be used by installations using different DBs. We should use column IDs instead. This is what bug 302326 is trying to do and this is the right fix IMO.
Depends on: 302326
Whiteboard: [blocker will fix]
Assignee: query-and-buglist → wurblzap
Fixed by blocker!
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.