Project

General

Profile

Actions

Bug #30681

closed

Filter on fact value is not working properly when FactValue has some default loads

Added by Ondřej Ezr over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Facts
Target version:
-
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

Description

https://paste.centos.org/view/63f0f64c

filter on Host `os = Centos and facts.zzz = qq` causes following

SELECT "fact_values"."id" AS t0_r0, "fact_values"."value" AS t0_r1, "fact_values"."fact_name_id" AS t0_r2, "fact_values"."host_id" AS t0_r3, "fact_values"."updated_at" AS t0_r4, "fact_values"."created_at" AS t0_r5, "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"."ancestry" AS t1_r6, "taxonomies"."title" AS t1_r7, "taxonomies"."description" AS t1_r8, "locations_fact_values"."id" AS t2_r0, "locations_fact_values"."name" AS t2_r1, "locations_fact_values"."type" AS t2_r2, "locations_fact_values"."created_at" AS t2_r3, "locations_fact_values"."updated_at" AS t2_r4, "locations_fact_values"."ignore_types" AS t2_r5, "locations_fact_values"."ancestry" AS t2_r6, "locations_fact_values"."title" AS t2_r7, "locations_fact_values"."description" AS t2_r8 FROM "fact_values" INNER JOIN "hosts" ON "hosts"."organization_id" IN ('1', '2') AND "hosts"."location_id" IN ('3', '4', '5', '6', '7', '8') AND "hosts"."id" = "fact_values"."host_id" INNER JOIN "fact_names" ON "fact_names"."id" = "fact_values"."fact_name_id" LEFT OUTER JOIN "hosts" "hosts_fact_values_join" ON "hosts_fact_values_join"."organization_id" IN ('9', '10') AND "hosts_fact_values_join"."location_id" IN ('11', '12', '13', '14', '15', '16') AND "hosts_fact_values_join"."id" = "fact_values"."host_id" LEFT OUTER JOIN "taxonomies" ON "taxonomies"."id" = "hosts_fact_values_join"."organization_id" AND "taxonomies"."type" = 'Organization' LEFT OUTER JOIN "hosts" "hosts_fact_values_join_2" ON "hosts_fact_values_join_2"."organization_id" IN ('18', '19') AND "hosts_fact_values_join_2"."location_id" IN ('20', '21', '22', '23', '24', '25') AND "hosts_fact_values_join_2"."id" = "fact_values"."host_id" LEFT OUTER JOIN "taxonomies" "locations_fact_values" ON "locations_fact_values"."id" = "hosts_fact_values_join_2"."location_id" AND "locations_fact_values"."type" = 'Location' WHERE ((("taxonomies"."id" IN ('3','2')) AND ("taxonomies"."id" IN ('1','4','5','6','7','8')))) AND ((hosts.name = 'dale-weems.dummy')) AND "fact_values"."host_id" IN (SELECT "hosts"."id" FROM "hosts" LEFT OUTER JOIN "operatingsystems" ON "operatingsystems"."id" = "hosts"."operatingsystem_id" WHERE "hosts"."type" = 'Host::Managed' AND "hosts"."organization_id" IN ('1', '2') AND "hosts"."location_id" IN ('30', '31', '32', '33', '34', '35') AND ((("operatingsystems"."name" = 'Centos') AND (hosts.id in (SELECT "fact_values"."host_id" FROM "fact_values" INNER JOIN "hosts" ON "hosts"."organization_id" IN (3, 2) AND "hosts"."location_id" IN (1, 4, 5, 6, 7, 8) AND "hosts"."id" = "fact_values"."host_id" INNER JOIN "fact_names" ON "fact_names"."id" = "fact_values"."fact_name_id" LEFT OUTER JOIN "hosts" "hosts_fact_values_join" ON "hosts_fact_values_join"."organization_id" IN (3, 2) AND "hosts_fact_values_join"."location_id" IN (1, 4, 5, 6, 7, 8) AND "hosts_fact_values_join"."id" = "fact_values"."host_id" LEFT OUTER JOIN "taxonomies" ON "taxonomies"."id" = "hosts_fact_values_join"."organization_id" AND "taxonomies"."type" = 'Organization' LEFT OUTER JOIN "hosts" "hosts_fact_values_join_2" ON "hosts_fact_values_join_2"."organization_id" IN (3, 2) AND "hosts_fact_values_join_2"."location_id" IN (1, 4, 5, 6, 7, 8) AND "hosts_fact_values_join_2"."id" = "fact_values"."host_id" LEFT OUTER JOIN "taxonomies" "locations_fact_values" ON "locations_fact_values"."id" = "hosts_fact_values_join_2"."location_id" AND "locations_fact_values"."type" = 'Location' WHERE ((("taxonomies"."id" IN ('3','2')) AND ("taxonomies"."id" IN ('1','4','5','6','7','8')))) AND ((hosts.name = 'dale-weems.dummy')) AND (fact_names.name = 'zzz') AND (fact_values.value = 'qq') ORDER BY "fact_values"."value" ASC NULLS FIRST )) AND ("hosts"."organization_id" IN ('3','2')) AND ("hosts"."location_id" IN ('1','4','5','6','7','8')))) AND "hosts"."organization_id" IN ('36', '37') AND "hosts"."location_id" IN ('38', '39', '40', '41', '42', '43')) AND (fact_names.name <> '_timestamp') AND "fact_names"."ancestry" IS NULL ORDER BY "fact_values"."value" ASC NULLS FIRST LIMIT 50 OFFSET 0


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #30555: Authorizer is unable to handle association mismatchClosedOndřej EzrActions
Actions #1

Updated by Ondřej Ezr over 3 years ago

  • Subject changed from Filter on fact value is not working properly when fact has some load to Filter on fact value is not working properly when FactValue has some default loads
Actions #2

Updated by The Foreman Bot over 3 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/7913 added
Actions #3

Updated by Ondřej Ezr over 3 years ago

  • Related to Bug #30555: Authorizer is unable to handle association mismatch added
Actions #4

Updated by Ondřej Ezr over 3 years ago

  • Description updated (diff)
Actions #5

Updated by The Foreman Bot over 3 years ago

  • Fixed in Releases 2.3.0 added
Actions #6

Updated by Ondřej Ezr over 3 years ago

  • Status changed from Ready For Testing to Closed
Actions #7

Updated by Tomer Brisker over 3 years ago

  • Category set to Facts
Actions

Also available in: Atom PDF