Bug 428173 - Searching for two flags does not find anything
Searching for two flags does not find anything
Status: CLOSED WONTFIX
Product: Bugzilla
Classification: Community
Component: Query/Bug List (Show other bugs)
3.6
All Linux
low Severity low (vote)
: ---
: ---
Assigned To: PnT DevOps Devs
https://bugzilla.redhat.com/buglist.c...
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-09 14:25 EST by Jan Pazdziora
Modified: 2013-06-23 22:27 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-27 04:12:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jan Pazdziora 2008-01-09 14:25:32 EST
Description of problem:

I try to find bugs that have two particular flags set. So I use the advanced
query and into Advanced Searching Using Boolean Charts put 'Flag' 'is equal to'
value1 And 'Flag' 'is equal to' value2.

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

2.18-rh (bugzilla at bugzilla.redhat.com as of today).

How reproducible:

Deterministic.

Steps to Reproduce:
1. Use the URL in URL of this bugzilla or just create advanced query asking for
two flags.
  
Actual results:

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,
bugs.rep_platform, map_assigned_to.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 = 62946 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 WHERE bugs.assigned_to = map_assigned_to.userid AND
((CONCAT(flagtypes_0.name,flags_0.status) = 'sat-510+') AND
(CONCAT(flagtypes_0.name,flags_0.status) = 'pm_ack?')) AND
((bug_group_map.group_id IS NULL)  OR bug_group_map.group_id IN
(81,134,106,152,149,75,68,148,138,144,140,12,79,76,67,41,161,127,58,122,141,35,133,7,62,126,93,146,72,11,50,39,10,33,107,22,4,119,78,123,145,108,139,44,124,150,121,85,92,91,137,15,80,21,142,61,155,83,74,147,94)
 OR (bugs.reporter_accessible = 1 AND bugs.reporter = 62946)  OR
(bugs.cclist_accessible = 1 AND cc.who IS NOT NULL)  OR (bugs.assigned_to =
62946)  OR (bugs.qa_contact = 62946) ) 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,bugs.bug_status,bugs.resolution,bugs.short_desc
ORDER BY map_assigned_to.login_name,bugs.alias,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

For help, please send mail to the webmaster (bugzilla-owner@redhat.com), giving
this error message and the time and date of the error. 

Expected results:

No error, bug list with bugs having both those flags set.

Additional info:
Comment 1 David Lawrence 2008-09-16 12:55:44 EDT
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.
Comment 2 Jan Pazdziora 2008-09-17 02:42:44 EDT
Bugzilla 3.2 no longer gives the database error but it does not produce the correct output either.

Consider query

https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&product=Red+Hat+Network+Satellite&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=sat-5.2.0%2B

which returns RHN Satellite bugs with sat-5.2.0+ set (102 bugzillas found today).

Consider query

https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&product=Red+Hat+Network+Satellite&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=pm_ack%2B

which returns RHN Satellite bugs with pm_ack+ set (1033 bugzillas found today).

Now let's try to find bugzillas that have both flags set, for example 186920, 441342, or 441526:

https://bugzilla.redhat.com/buglist.cgi?query_format=advanced&product=Red+Hat+Network+Satellite&field0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=sat-5.2.0%2B&field0-1-0=flagtypes.name&type0-1-0=equals&value0-1-0=pm_ack%2Bfield0-0-0=flagtypes.name&type0-0-0=equals&value0-0-0=pm_ack%2B

The above produces Zarro Boogs found.

Not the expected result.

I've updated this bugzilla's summary.
Comment 3 David Lawrence 2008-11-25 17:16:57 EST
We may need to push this upstream or work in cooperation with them to find a solution to this problem.
Comment 4 David Lawrence 2010-01-15 11:56:06 EST
Red Hat Bugzilla is now using version 3.4 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.4.
Comment 5 David Lawrence 2010-08-25 17:44:22 EDT
Red Hat has now upgraded to Bugzilla 3.6 and this bug will now be reassigned to that version. It would be helpful to the Bugzilla Development Team if this bug is verified to still be an issue with the latest version. If it is no longer an issue, then feel free to close, otherwise please comment that it is still a problem and we will try to address the issue as soon as we can.

Thanks
Bugzilla Development Team
Comment 7 David Lawrence 2010-08-26 13:45:07 EDT
When comparing different values for the same Bugzilla field, there is a flaw in the SQL that is generated which causes an impossible comparison since the same column in a table cannot be equal to two different values. The workaround is to use a separate boolean chart when AND'ing two values from the same field.

https://bugzilla.redhat.com/query.cgi?columnlist=bug_severity%2Cpriority%2Cop_sys%2Cassigned_to%2Cbug_status%2Cresolution%2Cshort_desc%2Cflags&field0-0-0=flagtypes.name&field1-0-0=flagtypes.name&product=Red%20Hat%20Network%20Satellite&query_format=advanced&type0-0-0=equals&type1-0-0=equals&value0-0-0=sat-5.2.0%2B&value1-0-0=pm_ack%2B

FWIW, the backend Search.pm code is getting revamped for a future Bugzilla release but is a large undertaking.

Dave
Comment 8 Jan Pazdziora 2010-08-27 04:12:10 EDT
Dave, the query from comment 7 works -- thanks! I think we can close this bugzilla now as the approach with two charts is sufficient.
Comment 9 Alasdair Kergon 2012-01-03 09:57:57 EST
Perhaps it could at least detect when this combination of parameters is supplied and give a warning instead of pretending to carry out a query it can't actually handle correctly?
Comment 10 Alasdair Kergon 2012-01-03 10:17:42 EST
I wonder if the fix is as simple as 'my $flags = "flags_$$chartid_$$row";' in _flagtypes_name()
Comment 11 Alasdair Kergon 2012-01-03 10:35:02 EST
The 'cc' field suffers from the same bug if used within a chart.  Version 4 also looks broken (but I've not tried it).  It seems most of the queries using LEFT_JOIN fields forget to append a monotonic counter such as the row number when used within a chart.

Note You need to log in before you can comment on or make changes to this bug.