Closed
Bug 731163
Opened 12 years ago
Closed 12 years ago
Search.pm can use undefined alias in ORDER BY clause for %old_names fields
Categories
(Bugzilla :: Query/Bug List, defect)
Tracking
()
RESOLVED
FIXED
Bugzilla 4.2
People
(Reporter: davidt, Assigned: LpSolit)
References
()
Details
(Keywords: regression)
Attachments
(1 file)
651 bytes,
patch
|
dkl
:
review+
|
Details | Diff | Splinter Review |
After upgrading from 4.0 to 4.2, some saved queries started causing an Internal Server Error. After investigation, this appears to be due to the query being sorted by changed date, but not including the changed date in the set of displayed columns. I'm not sure that's a valid saved query, but I somehow managed to create it in 4.0, and it worked until now - and it shouldn't cause a crash. I have reproduced the problem on landfill.bugzilla.org - see the URL. The problem seems to be due to the %old_names translation in Search.pm. The code uses the 'changeddate' name in the ORDER BY clause, which is normally fine if the change date is in the displayed fields as delta_ts will have been aliased to changeddate and the ORDER BY will work. When the field is not displayed, the alias is undefined and the query fails.
Reporter | ||
Updated•12 years ago
|
Reporter | ||
Comment 1•12 years ago
|
||
OK, now I feel silly - I tried to simplify the test case, but actually it worked correctly. For some reason the bug only shows up when searching by classification. The revised test URL shows the problem for both changeddate and opendate.
Assignee | ||
Comment 2•12 years ago
|
||
I can reproduce using your new URL. Thanks for catching that.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking4.2.1+
Keywords: regression
Target Milestone: --- → Bugzilla 4.2
Assignee | ||
Comment 3•12 years ago
|
||
For the record: DBD::mysql::st execute failed: Unknown column 'opendate' in 'order clause' [for Statement "SELECT bugs.bug_id AS bug_id, bugs.bug_severity AS bug_severity, bugs.priority AS priority, bugs.bug_status AS bug_status, bugs.resolution AS resolution, map_product.name AS product FROM bugs LEFT JOIN bug_group_map AS security_map ON bugs.bug_id = security_map.bug_id INNER JOIN products AS map_product ON bugs.product_id = map_product.id WHERE bugs.creation_ts IS NOT NULL AND security_map.group_id IS NULL AND map_product.classification_id IN (SELECT classifications.id FROM classifications WHERE classifications.name IN ('Test') ) AND bugs.delta_ts >= '2012-01-28 03:29:14' AND bugs.creation_ts >= '2012-01-28 03:29:14' GROUP BY bugs.bug_id ORDER BY opendate DESC, changeddate DESC LIMIT 500 "] at /var/www/html/bugzilla-4.2-branch/buglist.cgi line 834
Assignee | ||
Comment 4•12 years ago
|
||
The reason it fails when the classification column is displayed is because _classification_nonchanged() calls _add_extra_column('product'), and once $self->{extra_columns} is populated, _valid_order_columns() is ignored, which is incorrect.
Assignee: query-and-buglist → LpSolit
Status: NEW → ASSIGNED
Attachment #602952 -
Flags: review?(dkl)
Comment 5•12 years ago
|
||
Comment on attachment 602952 [details] [diff] [review] patch, v1 Review of attachment 602952 [details] [diff] [review]: ----------------------------------------------------------------- Looks good and fixes the issue reported in my testing. r=dkl
Attachment #602952 -
Flags: review?(dkl) → review+
Assignee | ||
Updated•12 years ago
|
Flags: approval4.2+
Flags: approval+
Assignee | ||
Comment 6•12 years ago
|
||
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Search.pm Committed revision 8152. Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/4.2/ modified Bugzilla/Search.pm Committed revision 8050.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•