Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1481138 - PG::Error: missing FROM-clause entry from items in Dashboard for Filtered role
Summary: PG::Error: missing FROM-clause entry from items in Dashboard for Filtered role
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Users & Roles
Version: 6.2.10
Hardware: All
OS: All
medium
medium
Target Milestone: Unspecified
Assignee: Andrew Kofink
QA Contact: Sanket Jagtap
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-14 08:23 UTC by Anand Agrawal
Modified: 2021-06-10 12:48 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 17:04:04 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
PG Error (340.03 KB, image/png)
2017-08-14 08:23 UTC, Anand Agrawal
no flags Details
PG Error 2 (201.63 KB, image/png)
2017-08-14 08:24 UTC, Anand Agrawal
no flags Details
Filters on the user (31.07 KB, image/png)
2017-10-27 12:04 UTC, Sanket Jagtap
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 21253 0 None None None 2017-10-09 16:31:47 UTC
Foreman Issue Tracker 21254 0 None None None 2017-10-11 15:50:33 UTC
Red Hat Bugzilla 1463813 0 medium CLOSED PG::Error: ERROR: missing FROM-clause entry for table "katello_environments" when viewing activation keys as a user wit... 2021-02-22 00:41:40 UTC

Internal Links: 1463813

Description Anand Agrawal 2017-08-14 08:23:10 UTC
Created attachment 1312990 [details]
PG Error

Description of problem:

PG error on items in Dashboard such as latest Errata and latest events.

When creating a custom role with the following filters
1. Resource Miscellaneous => access_dashboard 
2. Host => view_hosts, edit_hosts, destroy_hosts with unlimited unselected and search "host_collection = HostCollection1 or host_collection = HostCollection2"

And assign this role to the user. 

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

How reproducible:

Always

Steps to Reproduce:
1. Create a custom role 'Custom role'
2. Assign above mentioned filters to the above created Custom role
3. Assign this custom role to the user.
4. Try to login with this user.
5. Hit the dashboard menu

Actual results:

Failure: PG::Error: ERROR:  subquery in FROM must have an alias
LINE 1: SELECT COUNT(count_column) FROM (SELECT  1 AS count_column F...
                                        ^
HINT:  For example, FROM (SELECT ...) [AS] foo.
: 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"
        INNER JOIN "katello_host_collection_hosts"
        ON "hosts"."id" = "katello_host_collection_hosts"."host_id" 
        INNER JOIN "katello_host_collections"
        ON "katello_host_collection_hosts"."host_collection_id" = "katello_host_collections"."id" 
 WHERE "katello_host_collections"."name" = 'HostCollection1' )) OR ("hosts"."id" IN (SELECT "hosts"."id" FROM         "hosts"
        INNER JOIN "katello_host_collection_hosts"
        ON "hosts"."id" = "katello_host_collection_hosts"."host_id" 
        INNER JOIN "katello_host_collections"
        ON "katello_host_collection_hosts"."host_collection_id" = "katello_host_collections"."id" 
 WHERE "katello_host_collections"."name" = 'HostCollection2' )))))) LIMIT 6) subquery_for_count


Expected results:
User should be able to view the items latest Errata and latest events on dashboard

Additional info:
when changing the search filter with '~' in place of '=' it works

host_collection ~ HostCollection1 or host_collection ~ HostCollection2

Comment 1 Anand Agrawal 2017-08-14 08:24:12 UTC
Created attachment 1312991 [details]
PG Error 2

Comment 2 Marek Hulan 2017-08-14 09:08:35 UTC
Seems like a duplicate of BZ #1232877 which was meant to be fixed in 6.2.8. It could be also fixed by BZ #1391365 so we should verify on 6.3.

Comment 5 Andrew Kofink 2017-10-09 16:31:44 UTC
Created redmine issue http://projects.theforeman.org/issues/21253 from this bug

Comment 6 Andrew Kofink 2017-10-11 15:53:14 UTC
Note: both upstream issues are required to fix the dashboard.

Comment 7 Evgeni Golov 2017-10-17 11:35:58 UTC
this still needs the katello cherry pick.

Comment 8 Sanket Jagtap 2017-10-27 12:04:06 UTC
Created attachment 1344275 [details]
Filters on the user

Build : Satellite 6.3 snap 21

Created custom role and attached it to the user. Created 2 host collections with hosts in them 

Logged in with custom user , accessed dashboard.

No errors were seen on the dashboard

Comment 9 Bryan Kearney 2018-02-21 17:04:04 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


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