Description of problem: Bugzilla fails with the following error message when query contains boolean chart using AND or OR queries. For example, I searched using : 'Flag' 'contains the string' 'pm_ack+' OR 'Flag' 'contains the string' 'dev_ack+' and i also tried 'Flag' 'contains the string' 'pm_ack+' AND 'Flag' 'contains the string' 'dev_ack+' Both fail. See below for exact http query. ERROR MESSAGE ----------------- Software error: DBD::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, map_assigned_to.login_name, map_reporter.login_name, bugs.bug_status, 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 = 215842 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.product_id IN (131)) AND (bugs.bug_status IN ('NEW','ASSIGNED','NEEDINFO','MODIFIED','ON_DEV','ON_QA','VERIFIED','FAILS_QA','RELEASE_PENDING','POST','PASSES_QA'))) AND ((POSITION('pm_ack+' IN LOWER(CONCAT(flagtypes_0.name,flags_0.status))) != 0) AND (POSITION('dev_ack+' IN LOWER(CONCAT(flagtypes_0.name,flags_0.status))) != 0)) AND ((bug_group_map.group_id IS NULL) OR bug_group_map.group_id IN (96,81,134,113,111,54,34,149,138,144,140,12,79,76,127,58,182,122,35,133,120,7,62,126,93,37,17,146,99,162,131,84,39,8,107,55,4,31,32,119,78,153,123,108,139,44,124,150,19,135,183,102,85,136,82,15,80,155,98,117,147,86,106,68,75,148,118,130,67,65,41,161,171,40,112,141,11,50,72,10,109,33,22,100,48,145,101,184,16,121,92,91,154,25,114,21,30,116,142,61,83,74,103,94) OR (bugs.reporter_accessible = 1 AND bugs.reporter = 215842) OR (bugs.cclist_accessible = 1 AND cc.who IS NOT NULL) OR (bugs.assigned_to = 215842) OR (bugs.qa_contact = 215842) ) 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,map_assigned_to.login_name,map_reporter.login_name,bugs.bug_status,bugs.short_desc ORDER BY bugs.bug_status,bugs.bug_id"] 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 673 ----------------- Search query used ----------------- https://bugzilla.redhat.com/buglist.cgi?query_format=&short_desc_type=allwordssubstr&short_desc=&product=Red+Hat+Enterprise+Linux+4&version=&component=&target_milestone=&query_format=advanced&bug_status=NEW&bug_status=ASSIGNED&bug_status=NEEDINFO&bug_status=MODIFIED&bug_status=ON_DEV&bug_status=ON_QA&bug_status=VERIFIED&bug_status=FAILS_QA&bug_status=RELEASE_PENDING&bug_status=POST&bug_status=PASSES_QA&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&status_whiteboard_type=allwordssubstr&status_whiteboard=&fixed_in_type=allwordssubstr&fixed_in=&qa_whiteboard_type=allwordssubstr&qa_whiteboard=&devel_whiteboard_type=allwordssubstr&devel_whiteboard=&keywords_type=allwords&keywords=&cust_facing=&cust_facing_type=substring&emailassigned_to1=1&emailtype1=exact&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=exact&email2=&bugidtype=include&bug_id=&votes=&changedin=&chfieldfrom=&chfieldto=Now&chfieldvalue=&cmdtype=doit&order=Reuse+same+sort+as+last+time&field0-0-0=flagtypes.name&type0-0-0=substring&value0-0-0=pm_ack%2B&field0-1-0=flagtypes.name&type0-1-0=substring&value0-1-0=dev_ack%2B ----------------- Version-Release number of selected component (if applicable): 2.18-rh How reproducible: always, use the http query provided above. Additional info:
Well, I imagine this is actually a dup, so please dup it if it is. :-) I've found the work-around, which is to use separate boolean charts, and not use AND/ORs when searching for flag combinations. Suggested fix would be to at least catch these situations and report to the user that the combination confuses Bugzilla's 'little' head and that they should try to use multiple boolean charts instead. The exception should be caught and handled more gracefully.
Red Hat Bugzilla is now using version 3.2 of the Bugzilla codebase and therefore this bug will need to be re-verified against the new release. With the updated code this bug may no longer be relevant or may have been fixed in the new code. Updating bug version to 3.2.