Project

General

Profile

Bug #9398

Invalid MySQL query after login on 1.7.x

Added by Martin Matuška over 4 years ago. Updated over 4 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

For users with special roles, directly after login, this error appears:

Mysql2::Error: Unknown column 'hostgroups.title' in 'where clause': 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`.`organization_id` IN (2) AND `hosts`.`type` IN ('Host::Managed') AND ((((`hostgroups`.`title` LIKE 'Group%') AND (`hosts`.`organization_id` = '2')) OR (`hostgroups`.`name` = BINARY 'Group1') OR (`hostgroups`.`name` = BINARY 'Group2'))) ORDER BY `hosts`.`name` ASC) AND (status <> 0) AND ((`reports`.`reported_at` >= '2015-02-10')) LIMIT 6) subquery_for_count

The subquery:
SELECT `hosts`.`id` FROM `hosts` WHERE `hosts`.`organization_id` IN (2) AND `hosts`.`type` IN ('Host::Managed') AND ((((`hostgroups`.`title` LIKE 'Group%') AND (`hosts`.`organization_id` = '2')) OR (`hostgroups`.`name` = BINARY 'Group1') OR (`hostgroups`.`name` = BINARY 'Group2'))) ORDER BY `hosts`.`name` ASC

does not join in the hostgroups table, requests columns from it though.


Related issues

Is duplicate of Foreman - Bug #8817: PGError: ERROR: missing FROM-clause entry for table "hostgroups"Closed2014-12-31

History

#1 Updated by Dominic Cleal over 4 years ago

  • Is duplicate of Bug #8817: PGError: ERROR: missing FROM-clause entry for table "hostgroups" added

#2 Updated by Dominic Cleal over 4 years ago

  • Status changed from New to Duplicate

Thanks, tracked under #8817.

Also available in: Atom PDF