Project

General

Profile

Actions

Bug #11282

closed

search on numeric facts is broken if using "~".

Added by Amir Fefer over 8 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Facts
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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 issues 1 (0 open1 closed)

Related to Foreman - Feature #11150: Allow searching of facts as types other than stringClosedImri Zvik07/19/2015Actions
Actions #1

Updated by Dominic Cleal over 8 years ago

  • Related to Feature #11150: Allow searching of facts as types other than string added
Actions #2

Updated by Dominic Cleal over 8 years ago

  • translation missing: en.field_release set to 63
Actions #3

Updated by Imri Zvik over 8 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.

Actions #4

Updated by Ohad Levy over 8 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!

Actions #5

Updated by Imri Zvik over 8 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.

Actions #6

Updated by The Foreman Bot over 8 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2622 added
  • Pull request deleted ()
Actions #7

Updated by Dominic Cleal over 8 years ago

  • Status changed from Ready For Testing to New
  • Pull request added
  • Pull request deleted (https://github.com/theforeman/foreman/pull/2622)
Actions #8

Updated by The Foreman Bot over 8 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2626 added
  • Pull request deleted ()
Actions #9

Updated by Imri Zvik over 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #10

Updated by Dominic Cleal over 8 years ago

  • Assignee set to Imri Zvik
Actions

Also available in: Atom PDF