Defect #4801
closedActiveRecord::StatementInvalid when searching wikis
0%
Description
If you try to search wiki pages, the following error is logged and Redmine shows a 500 error:
Processing SearchController#index (for xx.xxx.xxx.xxx at 2010-02-11 12:46:10) [GET] Parameters: {"scope"=>"", "all_words"=>"1", "submit"=>"OK", "wiki_pages"=>"1", "action"=>"index", "documents"=>"1", "id"=>"xxxxxxxxxx", "changesets"=>"1", "q"=>"ActionController::InvalidAuthenticityToken", "issues"=>"1", "controller"=>"search"} ActiveRecord::StatementInvalid (Mysql::Error: Unknown column 'text' in 'where clause': SELECT DISTINCT `wiki_pages`.id FROM `wiki_pages` LEFT OUTER JOIN `wikis` ON `wikis`.id = `wiki_pages`.wiki_id LEFT OUTER JOIN `projects` ON `projects`.id = `wikis`.project_id WHERE ((projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='wiki') AND wikis.project_id IN (4)) AND (((LOWER(title) LIKE '%actioncontroller::invalidauthenticitytoken%') OR (LOWER(text) LIKE '%actioncontroller::invalidauthenticitytoken%')))) ORDER BY wiki_pages.created_on DESC LIMIT 11): app/controllers/search_controller.rb:79:in `index' app/controllers/search_controller.rb:78:in `each' app/controllers/search_controller.rb:78:in `index' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/rack/request_handler.rb:91:in `process_request' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_request_handler.rb:206:in `main_loop' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/railz/application_spawner.rb:376:in `start_request_handler' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/railz/application_spawner.rb:334:in `handle_spawn_application' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/utils.rb:182:in `safe_fork' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/railz/application_spawner.rb:332:in `handle_spawn_application' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:351:in `__send__' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:351:in `main_loop' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:195:in `start_synchronously' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:162:in `start' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:261:in `spawn_rails_application' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:254:in `spawn_rails_application' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:153:in `spawn_application' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/spawn_manager.rb:286:in `handle_spawn_application' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:351:in `__send__' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:351:in `main_loop' /usr/lib/ruby/site_ruby/1.8/phusion_passenger/abstract_server.rb:195:in `start_synchronously' /usr/lib/phusion_passenger/passenger-spawn-server:61
It seems (according to schema.rb) that the "text" column is actually in the "wiki_contents" table and not in "wiki_pages".
Updated by Jean-Philippe Lang almost 15 years ago
Can't reproduce. A join with wiki_contents table is expected.
Updated by Kai Krakow almost 15 years ago
While I try to reproduce why it works for you, I'm putting this question: Why does Redmine even try to find wiki content? I don't have this feature enabled for the project in question. On the search result page there's even the checkmark for "wiki" below the search box. It shouldn't be there, right?
Anyway, that's not the cause of the problem, as this traceback also occurs on projects having the wiki feature.
Updated by Kai Krakow almost 15 years ago
Okay I tracked this down to having to do with the nested inclusion of {:wiki => :project}
- as soon as I reduce this to just :wiki
it does join the contents table. But of course it's missing the projects table then.
Updated by Jean-Philippe Lang almost 15 years ago
Please give details about your environment as requested in SubmittingBugs.
Updated by Kai Krakow almost 15 years ago
No problem, here it is:
$ RAILS_ENV=production ruby script/about About your application's environment Ruby version 1.8.7 (i686-linux) RubyGems version 1.3.5 Rack version 1.0 Rails version 2.3.5 Active Record version 2.3.5 Active Resource version 2.3.5 Action Mailer version 2.3.5 Active Support version 2.3.5 Edge Rails revision 652bdeb3c3ef3692108cb3364f92df672f1dc1a7 Application root /home/*****/rails-apps/redmine Environment production Database adapter mysql Database schema version 20091227112908 About your Redmine plugins Redmine Hoptoad Server plugin 0.0.1 Redmine Code Review plugin 0.3.0
The rails environment is frozen in RAILS_ROOT/vender/rails
(v2.3.5 from github). Redmine is the 0.9-stable branch from svn (r3393):
$ LC_ALL=C svn info Path: . URL: http://redmine.rubyforge.org/svn/branches/0.9-stable Repository Root: http://redmine.rubyforge.org/svn Repository UUID: e93f8b46-1217-0410-a6f0-8f06a7374b81 Revision: 3411 Node Kind: directory Schedule: normal Last Changed Author: jplang Last Changed Rev: 3393 Last Changed Date: 2010-02-07 13:48:56 +0100 (Sun, 07 Feb 2010)
Updated by Jean-Philippe Lang almost 15 years ago
Please, try to unfreeze Rails and install the 2.3.5 gem version.
Also, try to reproduce without the 2 installed plugins.
Updated by Jean-Philippe Lang over 14 years ago
- Status changed from New to Closed
- Resolution set to Cant reproduce
Updated by Kai Krakow over 14 years ago
Since upgradng to Redmine 0.9.3 it somehow magically now works - although nothing changed in the problematic part of the code... :-/