Project

General

Profile

Actions

Bug #13645

open

Scoped search fails with 500 on postgresql if value can't be converted

Added by Tomáš Strachota almost 9 years ago. Updated over 8 years ago.

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

Description

Scoped search fails with internal server error on postgresql if the searched value can't be converted to a type of the column it's compared against. This happens for example when the search query tries to compare empty string with integer column.

Reproducible with hammer:

hammer filter list --search 'role_id = ""'
hammer filter list --search 'role_id = a'

Results in:

PG::Error: ERROR:  invalid input syntax for integer: "a" 
LINE 1: ..."id" = "filters"."role_id" WHERE (("roles"."id" = 'a'))  ORD...
                                                             ^
: SELECT  "filters"."id" AS t0_r0, "filters"."search" AS t0_r1, "filters"."role_id" AS t0_r2, "filters"."created_at" AS t0_r3, "filters"."updated_at" AS t0_r4, "filters"."taxonomy_search" AS t0_r5, "roles"."id" AS t1_r0, "roles"."name" AS t1_r1, "roles"."builtin" AS t1_r2, "roles"."permissions" AS t1_r3 FROM "filters" LEFT OUTER JOIN "roles" ON "roles"."id" = "filters"."role_id" WHERE (("roles"."id" = 'a'))  ORDER BY filters.role_id, filters.id LIMIT 1000 OFFSET 0


Related issues 2 (0 open2 closed)

Related to Hammer CLI - Bug #13064: Executing "hammer role filters" command throws SQL errorsClosed01/08/2016Actions
Has duplicate Foreman - Bug #14235: Executing "hammer role filters" command throws SQL errorsDuplicate03/16/2016Actions
Actions

Also available in: Atom PDF