Project

General

Profile

Bug #2579

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

Added by Dominic Cleal about 6 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Rails
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
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

Related to Foreman - Bug #3122: when fact filters are added to a user, error column reference "id" is ambiguous for dashboard and fact_valuesClosed2013-09-19
Related to Foreman - Bug #3863: when fact filters are added to a user, error column reference "id" is ambiguous for fact_valuesResolved2013-09-19

Associated revisions

Revision 65f764d6 (diff)
Added by Dominic Cleal about 6 years ago

fixes #2579 - explicitly list field name, workaround rails #5990

Revision 0ad33a98 (diff)
Added by Dominic Cleal about 6 years ago

fixes #2579 - explicitly list field name, workaround rails #5990
(cherry picked from commit 65f764d6081b04cd03fa56a78e6281b5221b0bac)

History

#1 Updated by Dominic Cleal about 6 years ago

  • Status changed from Assigned to Ready For Testing

#2 Updated by Dominic Cleal about 6 years ago

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

#3 Updated by Dominic Cleal over 5 years ago

  • Related to Bug #3122: when fact filters are added to a user, error column reference "id" is ambiguous for dashboard and fact_values added

#4 Updated by Dominic Cleal over 5 years ago

  • Related to Bug #3863: when fact filters are added to a user, error column reference "id" is ambiguous for fact_values added

Also available in: Atom PDF