Project

General

Profile

Actions

Bug #9398

closed

Invalid MySQL query after login on 1.7.x

Added by Martin Matuška about 9 years ago. Updated about 9 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
Difficulty:
Triaged:
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 1 (0 open1 closed)

Is duplicate of Foreman - Bug #8817: PGError: ERROR: missing FROM-clause entry for table "hostgroups"ClosedDominic Cleal12/31/2014Actions
Actions #1

Updated by Dominic Cleal about 9 years ago

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

Updated by Dominic Cleal about 9 years ago

  • Status changed from New to Duplicate

Thanks, tracked under #8817.

Actions

Also available in: Atom PDF