Project

General

Profile

Actions

Bug #21082

closed

Combination of owner search with generic search term ends up with sql issues

Added by Ivan Necas about 7 years ago. Updated over 6 years ago.

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

Description

Reproducer:

1. search for owner.id = current_user AND ITSBROKEN
2. exception is given:

PG::DuplicateAlias: ERROR:  table name "foreman_tasks_locks_owner" specified more than once
: SELECT  DISTINCT "foreman_tasks_tasks".* FROM "foreman_tasks_tasks" INNER JOIN "foreman_tasks_locks" ON "foreman_tasks_locks"."task_id" = "foreman_tasks_tasks"."id" INNER JOIN foreman_tasks_locks AS foreman_tasks_locks_owner
                 ON (foreman_tasks_locks_owner.task_id = foreman_tasks_tasks.id AND
                     foreman_tasks_locks_owner.resource_type = 'User' AND
                     foreman_tasks_locks_owner.name = 'task_owner') INNER JOIN foreman_tasks_locks AS foreman_tasks_locks_owner
                 ON (foreman_tasks_locks_owner.task_id = foreman_tasks_tasks.id AND
                     foreman_tasks_locks_owner.resource_type = 'User' AND
                     foreman_tasks_locks_owner.name = 'task_owner')
        INNER JOIN users as users
                   ON (users.id = foreman_tasks_locks_owner.resource_id) WHERE (((foreman_tasks_locks_owner.resource_id = 3) AND ("foreman_tasks_tasks"."id" ILIKE '%ITISBROKEN%' OR "foreman_tasks_tasks"."label" ILIKE '%ITISBROKEN%' OR "foreman_tasks_tasks"."state" ILIKE '%ITISBROKEN%' OR "foreman_tasks_tasks"."result" ILIKE '%ITISBROKEN%' OR "foreman_tasks_tasks"."parent_task_id" ILIKE '%ITISBROKEN%' OR foreman_tasks_locks."resource_type" ILIKE 'ITISBROKEN' OR users.login ILIKE 'ITISBROKEN' or users.firstname ILIKE 'ITISBROKEN'  OR users.login ILIKE 'ITISBROKEN' or users.firstname ILIKE 'ITISBROKEN' )))  ORDER BY "foreman_tasks_tasks"."started_at" DESC NULLS LAST  LIMIT 20 OFFSET 0

Expected:

No exception


Related issues 1 (0 open1 closed)

Related to foreman-tasks - Refactor #21083: Use explicit relation for task -> user associationClosedAdam RuzickaActions
Actions #1

Updated by The Foreman Bot about 7 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Ivan Necas
  • Pull request https://github.com/theforeman/foreman-tasks/pull/287 added
Actions #2

Updated by Ivan Necas about 7 years ago

  • Related to Refactor #21083: Use explicit relation for task -> user association added
Actions #3

Updated by Ivan Necas about 7 years ago

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

Updated by Ivan Necas about 7 years ago

  • Subject changed from Combination of owner search with generic search term ends up with sql issues to Combination of owner search with generic search term ends up with sql issues
  • Translation missing: en.field_release set to 316
Actions #5

Updated by Lukáš Hellebrandt over 6 years ago

VERIFIED with Katello 3.5 foreman-tasks 0.10.9.

Used steps from the OP. Without roles, the list is empty and searching in it leads to empty list once again, without any error.

Actions

Also available in: Atom PDF