Bug 1402611 - dashboard sql error when select '~' Like option in user role filter
Summary: dashboard sql error when select '~' Like option in user role filter
Keywords:
Status: CLOSED DUPLICATE of bug 1232877
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Dashboard
Version: 6.2.4
Hardware: Unspecified
OS: Unspecified
medium
medium vote
Target Milestone: Unspecified
Assignee: satellite6-bugs
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-12-08 00:08 UTC by Ashfaqur Rahaman
Modified: 2020-04-15 14:57 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-12-12 13:37:53 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Ashfaqur Rahaman 2016-12-08 00:08:56 UTC
Description of problem:

Dashboard is showing SQL error if we select '~' like option in User role "Host" filter. 

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

How reproducible:
100% 

Steps to Reproduce:

- Configure a Host Collection (lets call it 'Test Hostcollection 1')
- Add at least one host to 'Test Hostcollection 1'

- Create role "MyRole1" with below filters: 

1. Miscellaneous: access_dashboard, access_settings, view_plugins, view_statistics, view_tasks 
   Filter : None

2. Activation Keys : view_activation_keys 
   Filter: name ~ ak_capsule_provision 	

3. Content Host : edit_content_hosts, view_content_hosts, 
   Filter: host_collection ~ "Test Hostcollection 1" 	

4. Fact value: view_facts 
   Filter: none 	

5. Host : edit_hosts, build_hosts, view_hosts
   Filter: host_collection ~ "Test Hostcollection 1"  

6. Organization : view_organizations, view_subscriptions
   Filter : none

7. Product and Repositories: view_products
   Filter: none

- Create a user myUser1

- Assign the role myRole to myUser1

- Login as myUser1 and open the dashboard 

Actual results:

It gives the below error in dashboard :

---- 
PG::Error: ERROR: missing FROM-clause entry for table "katello_host_collections"
 LINE 1:
 ...id" IN (1) AND "hosts"."location_id" IN (2) AND (("katello_h... ^ :
 SELECT COUNT(count_column)
 FROM
 (SELECT 1 AS count_column FROM "katello_errata"
          INNER JOIN "katello_content_facet_errata" ON "katello_content_facet_errata"."erratum_id" = "katello_errata"."id" 
          INNER JOIN "katello_content_facets" ON "katello_content_facets"."id" = "katello_content_facet_errata"."content_facet_id"
               WHERE "katello_content_facets"."host_id" IN
                       (SELECT "hosts"."id" FROM "hosts" WHERE "hosts"."type"
                           IN ('Host::Managed') AND "hosts"."organization_id"
                           IN (1) AND "hosts"."location_id" IN (2) AND (("katello_host_collections"."name" ILIKE '%Test Hostcollection 1%'))) LIMIT 6)
                      subquery_for_count
----

Expected results:

It should show the dashboard

Additional info: 

There is a work around for this. In step 5, if we use '=' instead of '~' in "Host" filter, it works. 

---
5. Host : edit_hosts, build_hosts, view_hosts
   Filter: host_collection = "Test Hostcollection 1"  
---

Comment 3 Tomer Brisker 2016-12-12 13:37:53 UTC
Looks like this has been fixed already in https://bugzilla.redhat.com/show_bug.cgi?id=1232877 which should land in 6.3.
Marking as duplicate.

*** This bug has been marked as a duplicate of bug 1232877 ***


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