Project

General

Profile

Actions

Bug #5566

closed

Fact Values Query Produces Error

Added by Paul Calabro over 10 years ago. Updated over 6 years ago.

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

Description

When issuing the following query: fact = network_address <any string goes here>

I receive the following trace:

ActiveRecord::StatementInvalid
PGError: ERROR: syntax error at or near "OR" LINE 1: ...ub01%' OR "fact_names"."name" ILIKE '%dub01%' OR OR "hostgr... ^ : SELECT DISTINCT "fact_values".id, "fact_values"."value" AS alias_0 FROM "fact_values" LEFT OUTER JOIN "fact_names" ON "fact_names"."id" = "fact_values"."fact_name_id" LEFT OUTER JOIN "hosts" ON "hosts"."id" = "fact_values"."host_id" AND "hosts"."type" IN ('Host::Managed') LEFT OUTER JOIN "hostgroups" ON "hostgroups"."id" = "hosts"."hostgroup_id" LEFT OUTER JOIN "hosts" "hosts_fact_values" ON "hosts_fact_values"."id" = "fact_values"."host_id" AND "hosts_fact_values"."type" IN ('Host::Managed') INNER JOIN "fact_names" fact_names_364687 ON (fact_names_364687.id = fact_values.fact_name_id) WHERE (fact_names.name <> '_timestamp') AND ((fact_names_364687."name" = '') AND (("fact_names"."name" = 'network_address') AND ("fact_values"."value" ILIKE '%dub01%' OR "fact_values"."value" ILIKE '%dub01%' OR "fact_names"."name" ILIKE '%dub01%' OR OR "hostgroups"."name" ILIKE '%dub01%' OR "fact_names"."short_name" ILIKE '%dub01%'))) ORDER BY "fact_values"."value" ASC NULLS FIRST LIMIT 150 OFFSET 0
app/views/fact_values/index.html.erb:15:in `_app_views_fact_values_index_html_erb___1537369141514873972_74205940'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

If I change the query to: fact = network_address and host = <FQDN goes here>

it works fine.


Related issues 2 (0 open2 closed)

Has duplicate Foreman - Bug #5906: Can't search facts give error / facts search for a particular word does not workDuplicate05/23/2014Actions
Has duplicate Foreman - Bug #5670: Invalid sql when searching for two wordsDuplicate05/12/2014Actions
Actions

Also available in: Atom PDF