Project

General

Profile

Bug #683

Including extra tables in the "Reports search" inside the reports controller, results in this error:

Added by Bash Shell over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Database
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Including extra tables in the reports controller results in this error:

Processing ReportsController#index (for 10.22.2.15 at 2011-02-17 10:50:56) [GET]
  Parameters: {"search"=>{"interesting"=>"false", "host_name_like"=>"util1.qai", "order"=>"descend_by_created_at", "sources_value_like"=>"", "reported_at_gt"=>"[FILTERED]", "messages_value_like"=>"yum"}, "commit"=>"Go", "tab_name"=>"", "action"=>"index", "controller"=>"reports"}

ActiveRecord::StatementInvalid (Mysql::Error: Not unique table/alias: 'hosts': SELECT `reports`.`id` AS t0_r0, `reports`.`host_id` AS t0_r1, `reports`.`reported_at` AS t0_r2, `reports`.`created_at` AS t0_r3, `reports`.`updated_at` AS t0_r4, `reports`.`status` AS t0_r5, `reports`.`metrics` AS t0_r6, `hosts`.`id` AS t1_r0, `hosts`.`name` AS t1_r1, `hosts`.`ip` AS t1_r2, `hosts`.`environment` AS t1_r3, `hosts`.`last_compile` AS t1_r4, `hosts`.`last_freshcheck` AS t1_r5, `hosts`.`last_report` AS t1_r6, `hosts`.`updated_at` AS t1_r7, `hosts`.`source_file_id` AS t1_r8, `hosts`.`created_at` AS t1_r9, `hosts`.`mac` AS t1_r10, `hosts`.`sp_mac` AS t1_r11, `hosts`.`sp_ip` AS t1_r12, `hosts`.`sp_name` AS t1_r13, `hosts`.`root_pass` AS t1_r14, `hosts`.`serial` AS t1_r15, `hosts`.`puppetmaster` AS t1_r16, `hosts`.`puppet_status` AS t1_r17, `hosts`.`domain_id` AS t1_r18, `hosts`.`architecture_id` AS t1_r19, `hosts`.`operatingsystem_id` AS t1_r20, `hosts`.`environment_id` AS t1_r21, `hosts`.`subnet_id` AS t1_r22, `hosts`.`sp_subnet_id` AS t1_r23, `hosts`.`ptable_id` AS t1_r24, `hosts`.`medium_id` AS t1_r25, `hosts`.`build` AS t1_r26, `hosts`.`comment` AS t1_r27, `hosts`.`disk` AS t1_r28, `hosts`.`installed_at` AS t1_r29, `hosts`.`model_id` AS t1_r30, `hosts`.`hostgroup_id` AS t1_r31, `hosts`.`owner_id` AS t1_r32, `hosts`.`owner_type` AS t1_r33, `hosts`.`enabled` AS t1_r34, `domains`.`id` AS t2_r0, `domains`.`name` AS t2_r1, `domains`.`fullname` AS t2_r2, `domains`.`created_at` AS t2_r3, `domains`.`updated_at` AS t2_r4, `domains`.`dns_id` AS t2_r5 FROM `reports`  LEFT OUTER JOIN `hosts` ON `hosts`.id = `reports`.host_id  LEFT OUTER JOIN `domains` ON `domains`.id = `hosts`.domain_id INNER JOIN `hosts` ON `hosts`.id = `reports`.host_id INNER JOIN `logs` ON `logs`.`report_id` = `reports`.`id` INNER JOIN `messages` ON `logs`.`message_id` = `messages`.`id` WHERE ((hosts.name LIKE '%util1.qai%') AND (messages.value LIKE '%yum%'))  ORDER BY reports.created_at DESC LIMIT 0, 20):
  app/controllers/reports_controller.rb:24:in `index'
  passenger (2.2.14) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
  passenger (2.2.14) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
  passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:441:in `start_request_handler'
  passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:381:in `handle_spawn_application'
  passenger (2.2.14) lib/phusion_passenger/utils.rb:252:in `safe_fork'
  passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:377:in `handle_spawn_application'
  passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
  passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
  passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:163:in `start'
  passenger (2.2.14) lib/phusion_passenger/railz/application_spawner.rb:222:in `start'
  passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
  passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
  passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
  passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
  passenger (2.2.14) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
  passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
  passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
  passenger (2.2.14) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
  passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
  passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
  passenger (2.2.14) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

Rendering /usr/share/foreman/public/500.html (500 Internal Server Error)

Patch is attached.

Associated revisions

Revision d2487f16 (diff)
Added by Bash Shell over 8 years ago

Fixes #683 - Report list sometimes fail to generate the correct SQL query

History

#1 Updated by Bash Shell over 8 years ago

  • Status changed from New to Ready For Testing
  • % Done changed from 0 to 100

#2 Updated by Ohad Levy over 8 years ago

  • Category set to Database
  • Status changed from Ready For Testing to Closed
  • Assignee set to Bash Shell
  • Target version set to 0.2

Also available in: Atom PDF