Bug 1353749

Summary: ActiveRecord::StatementInvalid in dashboard
Product: Red Hat Satellite Reporter: Kim Borup <kborup>
Component: DashboardAssignee: Tomer Brisker <tbrisker>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: high Docs Contact:
Priority: high    
Version: 6.2.0CC: bbuckingham, bkearney, dhawke, jcallaha, kborup, mjahangi, sreber
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/16044
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:49:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1413361, 1417133    
Attachments:
Description Flags
Trace from sat error..
none
Filter description. none

Description Kim Borup 2016-07-07 22:25:44 UTC
Created attachment 1177472 [details]
Trace from sat error..

Description of problem:
when using filters for Dashboard in Satellite 6.2 an sql error occurs. 


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


How reproducible:

Always
Steps to Reproduce:
1.Create filters for users. 
2.login as user and press dashboard.
3.

Actual results:
Oops, we're sorry but something went wrong 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(DISTINCT count_column) FROM (SELECT DISTINCT "katello_errata"."id" 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_facet_errata" "content_facet_errata_katello_errata_join" ON "content_facet_errata_katello_errata_join"."erratum_id" = "katello_errata"."id" INNER JOIN "katello_content_facets" ON "katello_content_facets"."id" = "content_facet_errata_katello_errata_join"."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 'oss%'))) LIMIT 6) subquery_for_count


Expected results:
Seeing the dashboard. 

Additional info:

Comment 3 Brad Buckingham 2016-07-08 19:38:37 UTC
Hi Kim,  can you provide more details on the user?  For example, what roles/filters were associated with the user?

Did the Satellite have any host collections?

Comment 4 Kim Borup 2016-07-09 00:08:58 UTC
Created attachment 1177805 [details]
Filter description.

This is the filters for the user, however in this text you dont see the Dashboard filter, this were added at the time of the bug, however removed here, in order to temporary work arround it.

Comment 5 Brad Buckingham 2016-07-11 20:49:42 UTC
Can you attach the foreman-debug for your Satellite?
Was this error observed on an internal Satellite 6.2 build ?  Or on the official Beta or Beta2 builds?

Comment 6 Kim Borup 2016-07-13 02:30:00 UTC
The official beta 2 build. i will make a debug now.

Comment 8 Kim Borup 2016-07-13 02:33:54 UTC
have added the debug, the last output from the debug were 016-07-13 04:30:55 [app] [W] Action failed
 | ActiveRecord::StatementInvalid: 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(DISTINCT count_column) FROM (SELECT  DISTINCT "katello_errata"."id" 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_facet_errata" "content_facet_errata_katello_errata_join" ON "content_facet_errata_katello_errata_join"."erratum_id" = "katello_errata"."id" INNER JOIN "katello_content_facets" ON "katello_content_facets"."id" = "content_facet_errata_katello_errata_join"."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 'oss%'))) LIMIT 6) subquery_for_count

Comment 9 Daniel Lobato Garcia 2016-08-10 10:51:38 UTC
Created redmine issue http://projects.theforeman.org/issues/16044 from this bug

Comment 10 Bryan Kearney 2016-08-10 12:16:47 UTC
Upstream bug assigned to tbrisker

Comment 11 Bryan Kearney 2016-08-10 12:16:49 UTC
Upstream bug assigned to tbrisker

Comment 12 Bryan Kearney 2016-08-23 16:17:09 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/16044 has been closed

Comment 15 Peter Ondrejka 2016-11-28 15:41:40 UTC
Verified in Satellite 6.3 snap 6, user with filters mentioned in comment #4 (+ access_dashboard) can now view the dashboard without complications.

Comment 20 Satellite Program 2018-02-21 16:49:54 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336