Closed Bug 617641 Opened 14 years ago Closed 14 years ago

Using any of the _realname columns in Search.pm generates a SQL error

Categories

(Bugzilla :: Reporting/Charting, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.2

People

(Reporter: LpSolit, Assigned: mkanat)

References

()

Details

(Keywords: regression)

Attachments

(2 files)

When using the assignee/reporter/QA contact real names as row/column in tabular reports, the DB crashes with: On MySQL: DBD::mysql::db selectall_arrayref failed: Unknown column 'map_assigned_to.realname' in 'field list' [for Statement "SELECT map_assigned_to.realname AS assigned_to_realname, map_reporter.realname AS reporter_realname, -1 FROM bugs LEFT JOIN bug_group_map AS security_map ON bugs.bug_id = security_map.bug_id AND NOT ( security_map.group_id IN (1,12,10,11,13,9,4,8,5,6,7,3,2,29,26,28,27,18,14,20,15,16,17) ) LEFT JOIN cc AS security_cc ON bugs.bug_id = security_cc.bug_id AND security_cc.who = 1 WHERE bugs.creation_ts IS NOT NULL AND (security_map.group_id IS NULL OR (bugs.reporter_accessible = 1 AND bugs.reporter = 1) OR (bugs.cclist_accessible = 1 AND security_cc.who IS NOT NULL) OR bugs.assigned_to = 1 OR bugs.qa_contact = 1) GROUP BY bugs.bug_id "] at /var/www/html/bugzilla/report.cgi line 137 at /var/www/html/bugzilla/report.cgi line 137 On PostgreSQL: DBD::Pg::db selectall_arrayref failed: ERROR: missing FROM-clause entry for table "map_assigned_to" LINE 1: SELECT map_assigned_to.realname AS assigned_to_realname, map... ^ [for Statement "SELECT map_assigned_to.realname AS assigned_to_realname, map_reporter.realname AS reporter_realname, -1 FROM bugs LEFT JOIN bug_group_map AS security_map ON bugs.bug_id = security_map.bug_id WHERE bugs.creation_ts IS NOT NULL AND security_map.group_id IS NULL GROUP BY bugs.bug_id, map_assigned_to.realname,map_reporter.realname "] at /var/www/html/bugzilla-pg/report.cgi line 137 at /var/www/html/bugzilla-pg/report.cgi line 137 This was working fine in Bugzilla 4.0rc1, but fails in 4.1. Bugzilla 3.6 is not affected as these fields are not selectable in the 3.6.x series.
Okay, this is just a Search.pm regression from the refactoring, I think it will be very simple to fix.
Assignee: charting → mkanat
Could you fix xt/ tests to include a check for this? :)
(In reply to comment #2) > Could you fix xt/ tests to include a check for this? :) Ah, I don't think so, not that easily. I'll have to see what the bug is, though.
Attached patch v1Splinter Review
Okay here's a really simple patch that fixes this. I also got a test for it into xt! :-)
Attachment #516206 - Flags: review+
Flags: approval+
Summary: Tabular reports involving real names generate a SQL error → Using any of the _realname columns in Search.pm generates a SQL error
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Search.pm modified xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm Committed revision 7732
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
This doesn't fix comment 0 at all. Instead of the crash, I now get: There is no field named 'reporter_realname' Same for the assignee and QA contact.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Hmm, weird. Well, it works fine in buglist.cgi now. And it did change the error message, at least (although to something that doesn't make sense). I wouldn't block 4.1.1 on not being able to use realname as an axis, but it should still totally be fixed.
Attached patch Fix report.cgiSplinter Review
Okay, this very simple patch fixes the problem in report.cgi.
Attachment #517937 - Flags: review?(LpSolit)
Comment on attachment 517937 [details] [diff] [review] Fix report.cgi >+ $field = Bugzilla::Field->check($field_name) >+ # _realname fields aren't real Bugzilla::Field objects, >+ # but they are a valid axis. >+ if ($field_name && $field_name !~ /_realname$/); Please fix the indentation of the comment. Also, it would make more sense to have the comment above the first line instead of being in the middle of the code (it makes it easy to miss the if() condition). r=LpSolit with these fixes.
Attachment #517937 - Flags: review?(LpSolit) → review+
Committing to: bzr+ssh://bzr.mozilla.org/bugzilla/trunk/ modified report.cgi Committed revision 7768.
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: