Project

General

Profile

Bug #28415

Searching for tasks fails with PG::AmbiguousColumn: ERROR: ORDER BY "started_at" is ambiguous

Added by Adam Ruzicka about 2 years ago. Updated about 2 years ago.

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

Description

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
-----B<-----SNIP-----B<----- | /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'
-----B<-----SNIP-----B<-----

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


Related issues

Related to foreman-tasks - Bug #28485: Cannot sort tasks by durationClosed

Associated revisions

Revision da881a85 (diff)
Added by Adam Ruzicka about 2 years ago

Fixes #28415 - Fix PG::AmbiguousColumn error on tasks search (#481)

The original error was
'Action failed' error (ActiveRecord::StatementInvalid): PG::AmbiguousColumn:
ERROR: ORDER BY "started_at" is ambiguous | LINE 1: ...,4))

History

#1 Updated by The Foreman Bot about 2 years ago

  • Assignee set to Adam Ruzicka
  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman-tasks/pull/481 added

#2 Updated by Adam Ruzicka about 2 years ago

  • Bugzilla link set to 1779653

#3 Updated by The Foreman Bot about 2 years ago

  • Fixed in Releases foreman-tasks-0.18.0 added

#4 Updated by Anonymous about 2 years ago

  • Status changed from Ready For Testing to Closed

#5 Updated by Adam Ruzicka about 2 years ago

  • Fixed in Releases foreman-tasks-0.17.4 added
  • Fixed in Releases deleted (foreman-tasks-0.18.0)

#6 Updated by Adam Ruzicka about 2 years ago

  • Related to Bug #28485: Cannot sort tasks by duration added

Also available in: Atom PDF