Project

General

Profile

Actions

Bug #8817

closed

PGError: ERROR: missing FROM-clause entry for table "hostgroups"

Added by Jeffrey Miller over 9 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Users, Roles and Permissions
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

After migrating from Foreman 1.6.3 to 1.7.1, users that are not an administrator receive the above error line upon login (full error is listed at the end). There appears to be no other loss in functionality after the migration except for users that are not administrators. The users are successfully logged in and authenticated by the system.

The following observations have been found thus far:

URLs that result in the PGError:
/dashboard
/reports

Some URLs that do not result in the PGError:
/reports/6146670
/hosts
/hosts/F.Q.D.N/reports/last
/hostgroups
/fact_values
/statistics
/trends
/operatingsystems
/architectures

When selecting an individual host from the /hosts URL and upon clicking the reports button, the PGError occurs.

Navigating to the following URLs works:
/hosts?search=last_report+>"35+minutes+ago"
/hosts?search=last_report
>"35+minutes+ago"+and(status.failed+>0+or+status.failed_restarts>0)+and+status.enabled%3D+true
When the user goes to a specific report from that page, they can view the report.

The full trace one of the instances of the error (generated upon going to the dashboard after login) is:

ActiveRecord::StatementInvalid
PGError: ERROR: missing FROM-clause entry for table "hostgroups" LINE 1: ... WHERE "hosts"."type" IN ('Host::Managed') AND ((("hostgroup... ^ : SELECT COUNT FROM (SELECT "reports"."id" AS count_column FROM "reports" LEFT OUTER JOIN "hosts" ON "hosts"."id" = "reports"."host_id" AND "hosts"."type" IN ('Host::Managed') WHERE "reports"."host_id" IN (SELECT "hosts"."id" FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND ((("hostgroups"."id" = '5') OR ("hostgroups"."id" = '9') OR ("hostgroups"."id" = '1') OR ("hostgroups"."id" = '2') OR ("hostgroups"."id" = '8') OR ("hostgroups"."id" = '7') OR ("hostgroups"."id" = '17') OR ("hostgroups"."id" = '12') OR ("hostgroups"."id" = '16'))) ORDER BY "hosts"."name" ASC NULLS FIRST ) AND (status <> 0) AND (("reports"."reported_at" >= '2014-12-25')) LIMIT 6) subquery_for_count
app/views/dashboard/_reports_widget.html.erb:3:in `_app_views_dashboard__reports_widget_html_erb___1377828463669829617_74013300'
app/views/dashboard/index.html.erb:9:in `block in app_views_dashboard_index_html_erb_2431672577634662470_72666120'
app/views/dashboard/index.html.erb:8:in `map'
app/views/dashboard/index.html.erb:8:in `_app_views_dashboard_index_html_erb__2431672577634662470_72666120'
app/controllers/dashboard_controller.rb:6:in `index'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'


Related issues 5 (1 open4 closed)

Related to Foreman - Bug #5841: Foreman dashboard slow in 1.5 for non admin usersClosedDominic Cleal05/20/2014Actions
Related to Foreman - Bug #10627: Monitor -> Reports will show reports for hosts not in the Organization contextClosedDominic Cleal05/27/2015Actions
Related to Foreman - Bug #10819: PGError: ERROR: missing FROM-clause entry for table "hosts_reports" LINE 1New06/15/2015Actions
Has duplicate Foreman - Bug #9398: Invalid MySQL query after login on 1.7.xDuplicate02/16/2015Actions
Has duplicate Foreman - Bug #9409: Update from 1.6 to 1.7 user role problem in view Report and DashboardDuplicate02/17/2015Actions
Actions

Also available in: Atom PDF