Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1246839

Summary: PGError: ERROR: column reference "name" is ambiguous LINE 11
Product: Red Hat Satellite Reporter: Roy Golan <rgolan>
Component: WebUIAssignee: Tomer Brisker <tbrisker>
WebUI sub component: Foreman QA Contact: Tazim Kolhar <tkolhar>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: unspecified CC: bbuckingham, bkearney, cwelton, rgolan, sthirugn, tbrisker, tkolhar
Version: 6.1.0Keywords: Triaged
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/11220
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-09-15 07:22:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1338516    

Description Roy Golan 2015-07-26 10:07:03 UTC
Description of problem:

On Creating a host using this link https://satellite6-ops.rhev-ci-vms.eng.rdu2.redhat.com/hosts/new

I get a nice PG error 


Version-Release number of selected component (if applicable):
6.1 (beta)

How reproducible:
100%

Steps to Reproduce:
1. go to Hosts menu. click New Host
2. PG Error
3.

Actual results:




PGError: ERROR: column reference "name" is ambiguous LINE 11: WHERE "taxonomies"."id" = '5' )))) ORDER BY name ^ : SELECT "compute_resources"."id" AS t0_r0, "compute_resources"."name" AS t0_r1, "compute_resources"."description" AS t0_r2, "compute_resources"."url" AS t0_r3, "compute_resources"."user" AS t0_r4, "compute_resources"."password" AS t0_r5, "compute_resources"."uuid" AS t0_r6, "compute_resources"."type" AS t0_r7, "compute_resources"."created_at" AS t0_r8, "compute_resources"."updated_at" AS t0_r9, "compute_resources"."attrs" AS t0_r10, "compute_resources"."email" AS t0_r11, "taxonomies"."id" AS t1_r0, "taxonomies"."name" AS t1_r1, "taxonomies"."type" AS t1_r2, "taxonomies"."created_at" AS t1_r3, "taxonomies"."updated_at" AS t1_r4, "taxonomies"."ignore_types" AS t1_r5, "taxonomies"."description" AS t1_r6, "taxonomies"."label" AS t1_r7, "taxonomies"."default_info" AS t1_r8, "taxonomies"."apply_info_task_id" AS t1_r9, "taxonomies"."ancestry" AS t1_r10, "taxonomies"."title" AS t1_r11, "taxonomies"."katello_default" AS t1_r12, "locations_compute_resources"."id" AS t2_r0, "locations_compute_resources"."name" AS t2_r1, "locations_compute_resources"."type" AS t2_r2, "locations_compute_resources"."created_at" AS t2_r3, "locations_compute_resources"."updated_at" AS t2_r4, "locations_compute_resources"."ignore_types" AS t2_r5, "locations_compute_resources"."description" AS t2_r6, "locations_compute_resources"."label" AS t2_r7, "locations_compute_resources"."default_info" AS t2_r8, "locations_compute_resources"."apply_info_task_id" AS t2_r9, "locations_compute_resources"."ancestry" AS t2_r10, "locations_compute_resources"."title" AS t2_r11, "locations_compute_resources"."katello_default" AS t2_r12 FROM "compute_resources" LEFT OUTER JOIN "taxable_taxonomies" ON "taxable_taxonomies"."taxable_id" = "compute_resources"."id" AND "taxable_taxonomies"."taxable_type" = 'ComputeResource' LEFT OUTER JOIN "taxonomies" ON "taxonomies"."id" = "taxable_taxonomies"."taxonomy_id" AND taxonomies.type='Organization' LEFT OUTER JOIN "taxable_taxonomies" "taxable_taxonomies_compute_resources_join" ON "taxable_taxonomies_compute_resources_join"."taxable_id" = "compute_resources"."id" AND "taxable_taxonomies_compute_resources_join"."taxable_type" = 'ComputeResource' LEFT OUTER JOIN "taxonomies" "locations_compute_resources" ON "locations_compute_resources"."id" = "taxable_taxonomies_compute_resources_join"."taxonomy_id" AND taxonomies.type='Location' WHERE "compute_resources"."id" IN (NULL) AND (1=1) AND ((("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM "compute_resources" INNER JOIN "taxable_taxonomies" ON "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND taxonomies.type='Organization' WHERE "taxonomies"."id" = '14' )) AND ("compute_resources"."id" IN (SELECT "compute_resources"."id" FROM "compute_resources" INNER JOIN "taxable_taxonomies" ON "compute_resources"."id" = "taxable_taxonomies"."taxable_id" AND taxable_type = 'ComputeResource' INNER JOIN "taxonomies" ON "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" AND taxonomies.type='Location' WHERE "taxonomies"."id" = '5' )))) ORDER BY name

Comment 1 Tomer Brisker 2015-07-27 06:33:34 UTC
Could you please provide the relevant parts of production.log and foreman-debug?

Comment 2 Tomer Brisker 2015-07-27 10:51:11 UTC
Created redmine issue http://projects.theforeman.org/issues/11220 from this bug

Comment 3 Roy Golan 2015-08-16 09:47:50 UTC
Tomer, abraverman could supply all you need. I don't have access to that system.

Comment 4 Tomer Brisker 2015-08-18 09:08:43 UTC
I have reproduced the bug and confirmed that upstream PR fixes the issue.
In order to reproduce, user must have the view_compute_resources permission with a location and/or organization filter active.

Comment 7 Bryan Kearney 2015-08-19 13:05:34 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/11220 has been closed
-------------
Dominic Cleal
This looks much like https://github.com/theforeman/foreman/pull/2496.
-------------
avi tal
Applied in changeset commit:4ca9215584bf2b81a3291b728d0c436a9a773f41.

Comment 8 Brad Buckingham 2015-08-25 17:28:17 UTC
Tomer, can you provide verification steps for QE?

Comment 9 Tomer Brisker 2015-08-26 06:12:53 UTC
Verification steps:
1. Create a user that has a view_compute_resources permission that is filtered by location and/or organization.
2. Log in as that user and attempt to create a new host.

Behavior before patch:
PG Error breakes rendering of the page.

Behavior after patch:
New host creation form is displayed and allows selection of any compute resource that matches the user's filter.

Comment 11 Tazim Kolhar 2015-08-27 11:03:15 UTC
VERIFIED:
# rpm -qa | grep foreman
foreman-vmware-1.7.2.35-1.el6_6sat.noarch
ruby193-rubygem-foreman-redhat_access-0.2.3-1.el6_6sat.noarch
foreman-1.7.2.35-1.el6_6sat.noarch
ruby193-rubygem-foreman_hooks-0.3.7-2.el6_6sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el6_6sat.noarch
tyan-gt24-03.rhts.eng.bos.redhat.com-foreman-client-1.0-1.noarch
tyan-gt24-03.rhts.eng.bos.redhat.com-foreman-proxy-client-1.0-1.noarch
foreman-libvirt-1.7.2.35-1.el6_6sat.noarch
ruby193-rubygem-foreman_discovery-2.0.0.19-1.el6_6sat.noarch
ruby193-rubygem-foreman-tasks-0.6.15.5-1.el6_6sat.noarch
foreman-postgresql-1.7.2.35-1.el6_6sat.noarch
rubygem-hammer_cli_foreman-0.1.4.14-1.el6_6sat.noarch
tyan-gt24-03.rhts.eng.bos.redhat.com-foreman-proxy-1.0-1.noarch
foreman-selinux-1.7.2.13-1.el6_6sat.noarch
ruby193-rubygem-foreman_docker-1.2.0.20-1.el6_6sat.noarch
foreman-ovirt-1.7.2.35-1.el6_6sat.noarch
ruby193-rubygem-foreman_gutterball-0.0.1.9-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.5-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.9-1.el6_6sat.noarch
foreman-compute-1.7.2.35-1.el6_6sat.noarch
ruby193-rubygem-foreman_bootdisk-4.0.2.13-1.el6_6sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el6_6sat.noarch
foreman-gce-1.7.2.35-1.el6_6sat.noarch
foreman-proxy-1.7.2.5-1.el6_6sat.noarch
foreman-debug-1.7.2.35-1.el6_6sat.noarch


steps:
Steps to Reproduce:
1. go to Hosts menu. click New Host
New Hosts
Allows to create New Hosts

Comment 13 errata-xmlrpc 2015-09-15 07:22:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2015:1786