Bug 383121

Summary: Attempting to search for multiple flags breaks unique in query.
Product: [Community] Bugzilla Reporter: Corey Welton <cwelton>
Component: Query/Bug ListAssignee: PnT DevOps Devs <hss-ied-bugs>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2.18   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-11-14 19:35:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Corey Welton 2007-11-14 19:22:43 UTC
Description of problem:
If user tries to do a query which contains multiple flags in the boolean, s/he
is returned a SQL error.

Version-Release number of selected component (if applicable):
2.18rh

How reproducible:
Every time.

Steps to Reproduce:
1.  Login to bz; go to advanced query page.
2.  Scroll down to "Advanced Searching Using Boolean Charts"
3.  Using the "And" button to open a second boolean field, use the following
queries:
* Flag  is equal to  pm_ack+
* Flag  is equal to  rhel-4.6+
4.  Submit query.
  
Actual results:
SQL error:

BD::mysql::st execute failed: Not unique table/alias: 'flags_0' [for Statement
"SELECT bugs.bug_id, bugs.bug_severity, bugs.priority, bugs.bug_status,
bugs.resolution, bugs.alias, bugs.bug_severity, bugs.priority,
bugs.rep_platform, map_assigned_to.login_name, map_reporter.login_name,
bugs.bug_status, bugs.resolution, bugs.short_desc FROM bugs LEFT JOIN
bug_group_map  ON bug_group_map.bug_id = bugs.bug_id  LEFT JOIN cc ON cc.bug_id
= bugs.bug_id AND cc.who = 197269 LEFT JOIN flags AS flags_0 ON bugs.bug_id =
flags_0.bug_id AND flags_0.is_active = 1 LEFT JOIN flagtypes AS flagtypes_0 ON
flags_0.type_id = flagtypes_0.id LEFT JOIN flags AS flags_0 ON bugs.bug_id =
flags_0.bug_id AND flags_0.is_active = 1 LEFT JOIN flagtypes AS flagtypes_0 ON
flags_0.type_id = flagtypes_0.id , profiles AS map_assigned_to, profiles AS
map_reporter WHERE bugs.assigned_to = map_assigned_to.userid AND bugs.reporter =
map_reporter.userid AND ((bugs.bug_status IN
('NEW','ASSIGNED','NEEDINFO','MODIFIED'))) AND
((CONCAT(flagtypes_0.name,flags_0.status) = 'pm_ack+') AND
(CONCAT(flagtypes_0.name,flags_0.status) = 'rhel-4.6+')) AND
((bug_group_map.group_id IS NULL)  OR bug_group_map.group_id IN
(81,134,106,149,75,68,148,138,144,140,12,79,76,67,41,171,127,58,122,35,133,7,62,126,93,17,146,72,11,50,84,39,10,33,107,22,4,119,78,14,123,145,108,139,44,124,150,121,85,92,91,15,80,21,142,61,155,83,74,147,94)
 OR (bugs.reporter_accessible = 1 AND bugs.reporter = 197269)  OR
(bugs.cclist_accessible = 1 AND cc.who IS NOT NULL)  OR (bugs.assigned_to =
197269)  OR (bugs.qa_contact = 197269) ) GROUP BY bugs.bug_id,
bugs.bug_id,bugs.bug_severity,bugs.priority,bugs.bug_status,bugs.resolution,bugs.alias,bugs.bug_severity,bugs.priority,bugs.rep_platform,map_assigned_to.login_name,map_reporter.login_name,bugs.bug_status,bugs.resolution,bugs.short_desc
ORDER BY bugs.bug_id asc"] at Bugzilla/DB.pm line 71
	Bugzilla::DB::SendSQL('SELECT bugs.bug_id, bugs.bug_severity, bugs.priority,
bugs.bu...') called at /var/www/html/bugzilla/buglist.cgi line 659


Expected results:
Preferably the ability to search for more than one flag at a time (subqueries,
etc.).  But I guess something other than sql barf would suffice for now.

Additional info:
* Searches for either one of these flags works fine.  It's when a user wants an
intersect of these two flags that we run into an error.

Comment 1 David Lawrence 2007-11-14 19:35:45 UTC
Known issue with our current version of Bugzilla. To workaround this issue when
searching for multiple values of the same field type (in this case Flags) use the
"Add another boolean chart" button instead of "And". This should accomplish what
you want. This will be fixed in the upcoming upgrade to newer Bugzilla 3.0.