Bug #11282
closed
search on numeric facts is broken if using "~".
Added by Amir Fefer over 9 years ago.
Updated over 6 years ago.
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
- Related to Feature #11150: Allow searching of facts as types other than string added
- Translation missing: en.field_release set to 63
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.
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!
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.
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2622 added
- Pull request deleted (
)
- Status changed from Ready For Testing to New
- Pull request added
- Pull request deleted (
https://github.com/theforeman/foreman/pull/2622)
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2626 added
- Pull request deleted (
)
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Assignee set to Imri Zvik
Also available in: Atom
PDF