Project

General

Profile

Actions

Bug #2579

closed

Host groups with puppet classes triggers: column 'id' in field list is ambiguous

Added by Dominic Cleal over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When creating host groups with puppet classes or similar, AR doesn't supply the correct field name in the pluck when joining tables:

2.0.0p0 :020 > Hostgroup.first.puppetclass_ids
Hostgroup Load (39.7ms) SELECT `hostgroups`.* FROM `hostgroups` WHERE (1=1) LIMIT 1
(37.6ms) SELECT id FROM `puppetclasses` INNER JOIN `hostgroup_classes` ON `hostgroup_classes`.`puppetclass_id` = `puppetclasses`.`id` INNER JOIN `hostgroups` ON `hostgroups`.`id` = `hostgroup_classes`.`hostgroup_id` WHERE `hostgroups`.`id` IN (1)
ActiveRecord::StatementInvalid: Mysql::Error: Column 'id' in field list is ambiguous: SELECT id FROM `puppetclasses` INNER JOIN `hostgroup_classes` ON `hostgroup_classes`.`puppetclass_id` = `puppetclasses`.`id` INNER JOIN `hostgroups` ON `hostgroups`.`id` = `hostgroup_classes`.`hostgroup_id` WHERE `hostgroups`.`id` IN (1)

This is only in 3.2.8 (RPMs), not 3.2.13 (source). Looks like: https://github.com/rails/rails/issues/5990


Related issues 2 (0 open2 closed)

Related to Foreman - Bug #3122: when fact filters are added to a user, error column reference "id" is ambiguous for dashboard and fact_valuesClosed09/19/2013Actions
Related to Foreman - Bug #3863: when fact filters are added to a user, error column reference "id" is ambiguous for fact_valuesResolved09/19/2013Actions
Actions

Also available in: Atom PDF