Bug #21253

PG::Error: missing FROM-clause entry from items in Dashboard for Filtered role

Added by Andrew Kofink 4 months ago. Updated 3 months ago.

Status:Closed
Priority:Normal
Assigned To:Andrew Kofink
Category:-
Target version:-
Difficulty: Bugzilla link:1481138
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4903
Story points-
Velocity based estimate-
Release1.16.0Release relationshipAuto

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1481138

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 FROM (SELECT 1 AS count_column F...
^
HINT: For example, FROM (SELECT ...) [AS] foo.
: SELECT COUNT 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


Related issues

Related to Katello - Bug #21254: PG::Error: missing FROM-clause entry from items in Dashbo... Closed 10/09/2017

Associated revisions

Revision fa908536
Added by Andrew Kofink 3 months ago

Fixes #21253 - fix latest events widget

Revision fe5f36c1
Added by Andrew Kofink 3 months ago

Fixes #21253 - fix latest events widget

(cherry picked from commit fa908536885b602232208df0a974f995ed2a50e0)

History

#1 Updated by The Foreman Bot 4 months ago

  • Status changed from New to Ready For Testing
  • Assigned To set to Andrew Kofink
  • Pull request https://github.com/theforeman/foreman/pull/4903 added

#2 Updated by Andrew Kofink 4 months ago

  • Related to Bug #21254: PG::Error: missing FROM-clause entry from items in Dashboard for Filtered role added

#3 Updated by Timo Goebel 3 months ago

  • Subject changed from PG::Error: missing FROM-clause entry from items in Dashboard for Filtered role to PG::Error: missing FROM-clause entry from items in Dashboard for Filtered role
  • Release set to 1.15.5

#4 Updated by Timo Goebel 3 months ago

  • Release changed from 1.15.5 to 1.16.0

#5 Updated by Andrew Kofink 3 months ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF