Project

General

Profile

Actions

Bug #1292

closed

Searching hosts with parameters produces and SQL error

Added by Steve Traylen over 12 years ago. Updated over 12 years ago.

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

Description

Hi,

Using:

foreman-0.4-0.1rc4 on RHEL6, MySQL backend

Searching for hosts by params.value = key gives a SQL error.

e.g.

https://punch.example.org/dashboard?search=+params.ocsserver+%3D++ocsserv.cern.ch

The following error message was observed:

Mysql::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 '))' at line 1: SELECT count(*) AS count_all FROM `hosts` WHERE (())

Full trace:

ActiveRecord::StatementInvalid
Mysql::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 '))' at line 1: SELECT count(*) AS count_all FROM `hosts` WHERE (()) 
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:227:in `log'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:324:in `execute'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:639:in `select'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:81:in `cache_sql'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `select_one'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in `select_value'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:237:in `execute_simple_calculation'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:134:in `calculate'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:130:in `catch'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:130:in `calculate'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/calculations.rb:48:in `count'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `send'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:186:in `method_missing'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/base.rb:2182:in `with_scope'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `__send__'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:118:in `with_scope'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/named_scope.rb:179:in `method_missing'
/usr/share/foreman/app/controllers/dashboard_controller.rb:18:in `prefetch_data'
Actions #1

Updated by Ohad Levy over 12 years ago

  • Category changed from 19 to Search
  • Target version set to 0.4.1
Actions #2

Updated by Amos Benari over 12 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF