Bug #1358
closedPostgresql issue when selecting the hosts column under classes
Description
If you select the number of hosts in the column hosts when browsing classes you get:
Processing HostsController#index (for 10.45.62.2 at 2011-11-28 13:05:36) [GET]
Parameters: {"action"=>"index", "controller"=>"hosts", "search"=>"class = postgres::server"}
PGError: ERROR: syntax error at or near ")"
LINE 1: SELECT * FROM "hosts" WHERE (()) ORDER BY "hosts"."name" AS...
^
: SELECT * FROM "hosts" WHERE (()) ORDER BY "hosts"."name" ASC LIMIT 20 OFFSET 0
/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/postgresql_adapter.rb:520:in `execute'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1002:in `select_raw'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:989: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/base.rb:665:in `find_by_sql'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/base.rb:1582:in `find_every'
/usr/share/foreman/vendor/rails/activerecord/lib/active_record/base.rb:619:in `find'
/usr/share/foreman/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:82:in `send'
/usr/share/foreman/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:82:in `paginate'
/usr/share/foreman/vendor/plugins/will_paginate/lib/will_paginate/collection.rb:85:in `create'
/usr/share/foreman/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:76:in `paginate'
/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/hosts_controller.rb:35:in `index'
/usr/share/foreman/app/controllers/hosts_controller.rb:33:in `index'
Rendering template within layouts/application
Rendering common/500 (500)
This is with:
postgresql-server-8.4.9-1.el6_1.1.x86_64
postgres (0.7.9.2008.01.28)
I upgraded the gem to "pg" instead but the issue remains.