Red Hat Bugzilla – Bug 1246839
PGError: ERROR: column reference "name" is ambiguous LINE 11
Last modified: 2017-02-23 14:49:20 EST
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
Could you please provide the relevant parts of production.log and foreman-debug?
Created redmine issue http://projects.theforeman.org/issues/11220 from this bug
Tomer, abraverman@redhat.com could supply all you need. I don't have access to that system.
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.
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.
Tomer, can you provide verification steps for QE?
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.
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
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