Closed Bug 286461 Opened 20 years ago Closed 20 years ago

Unknown table 'map_products' in where clause

Categories

(Bugzilla :: Reporting/Charting, defect)

2.19.2
defect
Not set
critical

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: kristli, Assigned: bugreport)

Details

Attachments

(1 file, 3 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041020 Firefox/0.10.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.3) Gecko/20041020 Firefox/0.10.1

When creating a graphical report and selecting bugs using the Classification
filter but not using Classification in any of the axis the query fails:

DBD::mysql::st execute failed: Unknown table 'map_products' in where clause [for
Statement "SELECT 42217354, map_components.name, 42217354 FROM bugs, components
AS map_components  LEFT JOIN bug_group_map  ON bug_group_map.bug_id =
bugs.bug_id  AND bug_group_map.group_id NOT IN
(7,3,10,5,14,1,8,11,12,4,2,6,13,15,9)  LEFT JOIN cc ON cc.bug_id = bugs.bug_id
AND cc.who = 1 WHERE bugs.component_id = map_components.id AND
((map_products.classification_id IN (3)) AND (bugs.bug_status IN
('NEW','ASSIGNED','REOPENED'))) AND ((bug_group_map.group_id IS NULL)    OR
(bugs.reporter_accessible = 1 AND bugs.reporter = 1)     OR
(bugs.cclist_accessible = 1 AND cc.who IS NOT NULL)     OR (bugs.assigned_to =
1) OR (bugs.qa_contact = 1) ) GROUP BY bugs.bug_id"] at Bugzilla/DB.pm line 62
	Bugzilla::DB::SendSQL('SELECT 42217354, map_components.name, 42217354 FROM
bugs, com...') called at /var/www/html/Testzilla/report.cgi line 155

Reproducible: Always

Steps to Reproduce:
1.Create a classification
2.Add a product to classification
3.Add a few components to product
4.Add a few bugs to components
5.Go to Generate graphical report
6.Select a classification in the classification drop down list
7.select Component on horizontal axis

Breaks

It works if Component is selected on any of the axis.



I edited report.cgi and changed line 140 from:

if (lsearch(\@axis_fields,"classification") >= 0) {

to

if (lsearch(\@axis_fields,"classification") >= 0 || defined
$cgi->param('classification')) {

which seems to solve the problem.
This is my first time messing with bugzilla code, does my change make sense?
Version: unspecified → 2.19.2
I can reproduce
Severity: normal → critical
Status: UNCONFIRMED → NEW
Ever confirmed: true
Target Milestone: --- → Bugzilla 2.20
This is a problem in Search.pm caused by the implementation of classifications.
On line 138, it references a table alias name which has not necessarily been
defined. Reassigning the bug to the classifications implementor.

Gerv
Assignee: gerv → altlst
Attached patch first cut (obsolete) — Splinter Review
I'm not confident if this is the right approach, but I believe this patch will
fix the problem. Can you give it a shot?
Darn.  This works with my 2.19.2-based production system.  I see that Search.pm
has changed a bit since then.  Will have to upgrade to the tip before trying again. 
Attached patch second cut (obsolete) — Splinter Review
Gerv, give this one a shot.  I've updated my tip and this works for me.  But
I'm not familiar with Search.pm and am not confident I can just add the
additional sql commands to the @supptables array.  Curious if there might be a
conflict if it's also added here:

   if (lsearch($fieldsref, 'map_products.name') >= 0) {
	push @supptables, "INNER JOIN products AS map_products " .
			  "ON bugs.product_id = map_products.id";
   }
Attachment #178957 - Attachment is obsolete: true
Attachment #179081 - Flags: review?(gerv)
Comment on attachment 179081 [details] [diff] [review]
second cut

This doesn't help at all, I'm afraid. I still get the same error.

You may want to summon some of the Bugzilla SQL gurus to help you, and/or make
sure you can reproduce the problem and that it goes away with your next
attempt. :-)

Gerv
Attachment #179081 - Flags: review?(gerv) → review-
The problem is that product was not added unless is was an axis.  Buglist adds
product regardless so long as classifications are in use.  Probably, Search.pm
should contain this logic as well as any other similar prerequisite decisions.
But, that is another bug
Attachment #179081 - Attachment is obsolete: true
Attachment #179384 - Flags: review?(gerv)
Comment on attachment 179384 [details] [diff] [review]
Fixed the same way as buglist does it

Actually, on second thought, this wants to be fixed in Search.pm regardless. 
Fixing it in every caller is silly.
Attachment #179384 - Attachment is obsolete: true
Attachment #179384 - Flags: review?(gerv)
Attached patch Fix it rightSplinter Review
Attachment #179394 - Flags: review?(gerv)
Hi Gerv, I was able to see the failure and confirmed the original patch did fix
the problem for me.  But acknowledge my setup uses various other
patches/customization which may be conflicting with my solution.

In any case, thanks Joel for providing the right solution.
Comment on attachment 179394 [details] [diff] [review]
Fix it right

Seems to work for me. r=gerv.

Gerv
Attachment #179394 - Flags: review?(gerv) → review+
Assignee: altlst → bugreport
Flags: approval?
Flags: approval? → approval+
OS: Linux → All
Hardware: PC → All
Status: NEW → ASSIGNED
Checking in report.cgi;
/cvsroot/mozilla/webtools/bugzilla/report.cgi,v  <--  report.cgi
new revision: 1.29; previous revision: 1.28
done
Checking in Bugzilla/Search.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v  <--  Search.pm
new revision: 1.93; previous revision: 1.92
done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: