Project

General

Profile

Actions

Bug #5670

closed

Invalid sql when searching for two words

Added by Apely AGAMAKOU over 10 years ago. Updated over 10 years ago.

Status:
Duplicate
Priority:
Low
Assignee:
-
Category:
Search
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Hi

If i try to make a search based of facts name i have this issue.

ActiveRecord::StatementInvalid
Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OR `hostgroups`.`name` LIKE '%host%' OR `fact_names`.`short_name` LIKE '%host%')' at line 1: SELECT DISTINCT `fact_values`.id 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_171758 ON (fact_names_171758.id = fact_values.fact_name_id) WHERE `fact_names`.`ancestry` IS NULL AND (fact_names.name <> '_timestamp') AND ((fact_names_171758.`name` = '') AND (`fact_values`.`value` LIKE '%host%' OR `fact_values`.`value` LIKE '%host%' OR `fact_names`.`name` LIKE '%host%' OR OR `hostgroups`.`name` LIKE '%host%' OR `fact_names`.`short_name` LIKE '%host%')) ORDER BY `fact_values`.`value` ASC LIMIT 100 OFFSET 0
app/views/fact_values/index.html.erb:15:in `_app_views_fact_values_index_html_erb__1210802909006200332_86901560'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

OS: Debian 7.5
Foreman : 1.5.0-1
Mysql : 5.5.37-0+wheezy1


Related issues 1 (0 open1 closed)

Is duplicate of Foreman - Bug #5566: Fact Values Query Produces ErrorClosedJoseph Magen05/05/2014Actions
Actions

Also available in: Atom PDF