Actions
Bug #13645
openScoped search fails with 500 on postgresql if value can't be converted
Status:
New
Priority:
Normal
Assignee:
-
Category:
Search
Target version:
-
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
Updated by Tomáš Strachota almost 9 years ago
- Related to Bug #13064: Executing "hammer role filters" command throws SQL errors added
Updated by Shimon Shtein almost 9 years ago
role_id filter parameter is set to string in api/v2/filters_controller.rb
Probably needs change to integer. In addition we need to set validation in hammer-cli based on apipie type reported.
Updated by Dominic Cleal almost 9 years ago
- Has duplicate Bug #14235: Executing "hammer role filters" command throws SQL errors added
Updated by Dominic Cleal over 8 years ago
- Status changed from Duplicate to New
This isn't a duplicate, #13064 is filed against Hammer CLI and this is filed against Foreman's search feature. The server error is a valid bug report irrespective of a CLI fix.
Actions