Bug 1779653 - Searching for tasks fails with PG::AmbiguousColumn: ERROR: ORDER BY "started_at" is ambiguous
Summary: Searching for tasks fails with PG::AmbiguousColumn: ERROR: ORDER BY "started...
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Tasks Plugin
Version: 6.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: 6.7.0
Assignee: Adam Ruzicka
QA Contact: Peter Ondrejka
Depends On:
TreeView+ depends on / blocked
Reported: 2019-12-04 13:02 UTC by Adam Ruzicka
Modified: 2020-04-14 13:27 UTC (History)
3 users (show)

Fixed In Version: tfm-rubygem-foreman-tasks-0.17.4
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-04-14 13:27:45 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Foreman Issue Tracker 28415 Normal Closed Searching for tasks fails with PG::AmbiguousColumn: ERROR: ORDER BY "started_at" is ambiguous 2020-07-21 22:09:00 UTC
Red Hat Product Errata RHSA-2020:1454 None None None 2020-04-14 13:27:57 UTC

Description Adam Ruzicka 2019-12-04 13:02:52 UTC
2019-12-03T10:21:14 [D|app|aec885e2] Backtrace for 'Action failed' error (ActiveRecord::StatementInvalid): PG::AmbiguousColumn: ERROR:  ORDER BY "started_at" is ambiguous                                                                  
 | LINE 1: ...,4)) WHERE (("users"."login" = 'admin')) ORDER BY started_at...                                                                                                                                                               
 |                                                              ^                                                                                                                                                                           
 | : SELECT  DISTINCT foreman_tasks_tasks.*, *, coalesce(ended_at, current_timestamp) - coalesce(coalesce(started_at, ended_at), current_timestamp) as duration, "foreman_tasks_tasks"."id" AS t0_r0, "foreman_tasks_tasks"."type" AS t0_r1,
 "foreman_tasks_tasks"."label" AS t0_r2, "foreman_tasks_tasks"."started_at" AS t0_r3, "foreman_tasks_tasks"."ended_at" AS t0_r4, "foreman_tasks_tasks"."state" AS t0_r5, "foreman_tasks_tasks"."result" AS t0_r6, "foreman_tasks_tasks"."ext
ernal_id" AS t0_r7, "foreman_tasks_tasks"."parent_task_id" AS t0_r8, "foreman_tasks_tasks"."start_at" AS t0_r9, "foreman_tasks_tasks"."start_before" AS t0_r10, "foreman_tasks_tasks"."action" AS t0_r11, "foreman_tasks_tasks"."user_id" AS
 t0_r12, "foreman_tasks_tasks"."state_updated_at" AS t0_r13, "users"."id" AS t1_r0, "users"."login" AS t1_r1, "users"."firstname" AS t1_r2, "users"."lastname" AS t1_r3, "users"."mail" AS t1_r4, "users"."admin" AS t1_r5, "users"."last_l$
gin_on" AS t1_r6, "users"."auth_source_id" AS t1_r7, "users"."created_at" AS t1_r8, "users"."updated_at" AS t1_r9, "users"."password_hash" AS t1_r10, "users"."password_salt" AS t1_r11, "users"."locale" AS t1_r12, "users"."avatar_hash" $
S t1_r13, "users"."default_organization_id" AS t1_r14, "users"."default_location_id" AS t1_r15, "users"."lower_login" AS t1_r16, "users"."mail_enabled" AS t1_r17, "users"."timezone" AS t1_r18, "users"."description" AS t1_r19 FROM "fore$
an_tasks_tasks" LEFT OUTER JOIN "users" ON "users"."id" = "foreman_tasks_tasks"."user_id" AND (users.id IN (1,2,3,4,2,4,1,3,4)) WHERE (("users"."login" = 'admin')) ORDER BY started_at DESC LIMIT $1 OFFSET $2
 | /home/aruzicka/projects/foreman/foreman-tasks/app/controllers/foreman_tasks/api/tasks_controller.rb:299:in `map'                                                                                                                         
 | /home/aruzicka/projects/foreman/foreman-tasks/app/controllers/foreman_tasks/api/tasks_controller.rb:299:in `tasks_list'

If you sort by duration, the search for "user = admin" should work.

Comment 1 Adam Ruzicka 2019-12-04 13:02:57 UTC
Created from redmine issue https://projects.theforeman.org/issues/28415

Comment 2 Adam Ruzicka 2019-12-04 13:03:00 UTC
Upstream bug assigned to aruzicka@redhat.com

Comment 4 Bryan Kearney 2019-12-05 19:03:41 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28415 has been resolved.

Comment 5 Peter Ondrejka 2020-01-03 10:36:59 UTC
Verified on Sat 6.7 snap 7

Comment 8 errata-xmlrpc 2020-04-14 13:27:45 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.


Note You need to log in before you can comment on or make changes to this bug.