Bug #11282
closedsearch on numeric facts is broken if using "~".
Description
When trying to search a numeric value fact and using operator '~' there a 500 error:
"PG::UndefinedFunction: ERROR: operator does not exist: numeric ~~* integer
LINE 1: ... E'^\\d+$' AND CAST ILIKE 0)) ...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts."
recreate:
search- facts.uptime_days ~ 0
Updated by Dominic Cleal over 9 years ago
- Related to Feature #11150: Allow searching of facts as types other than string added
Updated by Dominic Cleal over 9 years ago
- Translation missing: en.field_release set to 63
Updated by Imri Zvik over 9 years ago
Excluding the LIKE operator for PG in cast_facts solved this issue.
i.e.
instead of:
elsif (is_int && is_pg)
do:
elsif (is_int && is_pg && operator !~ /LIKE/i)
Dominic, if it sounds like an acceptable solution to you, I will open a PR.
Updated by Ohad Levy over 9 years ago
Imri Zvik wrote:
Excluding the LIKE operator for PG in cast_facts solved this issue.
i.e.
instead of:
elsif (is_int && is_pg)do:
elsif (is_int && is_pg && operator !~ /LIKE/i)Dominic, if it sounds like an acceptable solution to you, I will open a PR.
I would suggest to open a PR and make sure you add the case mention here (and maybe others?) as a test?
thanks!
Updated by Imri Zvik over 9 years ago
Ohad Levy wrote:
Imri Zvik wrote:
Excluding the LIKE operator for PG in cast_facts solved this issue.
i.e.
instead of:
elsif (is_int && is_pg)do:
elsif (is_int && is_pg && operator !~ /LIKE/i)Dominic, if it sounds like an acceptable solution to you, I will open a PR.
I would suggest to open a PR and make sure you add the case mention here (and maybe others?) as a test?
thanks!
Already did in my fork ;)
I will open a PR tomorrow.
Updated by The Foreman Bot over 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2622 added
- Pull request deleted (
)
Updated by Dominic Cleal over 9 years ago
- Status changed from Ready For Testing to New
- Pull request added
- Pull request deleted (
https://github.com/theforeman/foreman/pull/2622)
Updated by The Foreman Bot over 9 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2626 added
- Pull request deleted (
)
Updated by Imri Zvik over 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 8658fa37c1f86cb5a34629e443141b03a0175a94.