Defect #10218

Error when creating a project with a version custom field

Added by Jörn Allmers almost 3 years ago. Updated almost 3 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Custom fields
Target version:1.3.2
Resolution:Fixed Affected version:1.3.1

Description

We have quite a few projects in out redmine install. If we try to add a new prject we get the following error.

ActionView::TemplateError (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 'OR (projects.status = 1 AND ( versions.sharing = 'system' OR (projects.lft >=  A' at line 1: SELECT `versions`.`id` AS t0_r0, `versions`.`project_id` AS t0_r1, `versions`.`name` AS t0_r2, `versions`.`description` AS t0_r3, `versions`.`effective_date` AS t0_r4, `versions`.`created_on` AS t0_r5, `versions`.`updated_on` AS t0_r6, `versions`.`wiki_page_title` AS t0_r7, `versions`.`status` AS t0_r8, `versions`.`sharing` AS t0_r9, `projects`.`id` AS t1_r0, `projects`.`name` AS t1_r1, `projects`.`description` AS t1_r2, `projects`.`homepage` AS t1_r3, `projects`.`is_public` AS t1_r4, `projects`.`parent_id` AS t1_r5, `projects`.`created_on` AS t1_r6, `projects`.`updated_on` AS t1_r7, `projects`.`identifier` AS t1_r8, `projects`.`status` AS t1_r9, `projects`.`lft` AS t1_r10, `projects`.`rgt` AS t1_r11 FROM `versions`  LEFT OUTER JOIN `projects` ON `projects`.id = `versions`.project_id WHERE (projects.id =  OR (projects.status = 1 AND ( versions.sharing = 'system' OR (projects.lft >=  AND projects.rgt <=  AND versions.sharing = 'tree') OR (projects.lft <  AND projects.rgt >  AND versions.sharing IN ('hierarchy', 'descendants')) OR (projects.lft >  AND projects.rgt <  AND versions.sharing = 'hierarchy')))) ) on line #21 of app/views/projects/_form.html.erb:
18: <%= wikitoolbar_for 'project_description' %>
19:
20: <% @project.custom_field_values.each do |value| %>
21:   <p><%= custom_field_tag_with_label :project, value %></p>
22: <% end %>
23: <%= call_hook(:view_projects_form, :project => @project, :form => f) %>
24: </div>

    app/models/custom_field.rb:69:in `possible_values_options'
    app/helpers/custom_fields_helper.rb:54:in `custom_field_tag'
    app/helpers/custom_fields_helper.rb:70:in `custom_field_tag_with_label'
    app/views/projects/_form.html.erb:21
    app/views/projects/_form.html.erb:20:in `each'
    app/views/projects/_form.html.erb:20
    app/views/projects/new.html.erb:4
    app/helpers/application_helper.rb:871:in `labelled_tabular_form_for'
    app/views/projects/new.html.erb:3
    /usr/lib/ruby/1.8/phusion_passenger/rack/request_handler.rb:92:in `process_request'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/utils.rb:184:in `safe_fork'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:163:in `start'
    /usr/lib/ruby/1.8/phusion_passenger/railz/application_spawner.rb:213:in `start'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `__send__'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:352:in `main_loop'
    /usr/lib/ruby/1.8/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
    /usr/lib/phusion_passenger/passenger-spawn-server:61

Mysql Version 5.1.49-3 (Debian)
Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.3.7
Rack version 1.1.2
Rails version 2.3.14
Active Record version 2.3.14
Active Resource version 2.3.14
Action Mailer version 2.3.14
Active Support version 2.3.14
Application root /var/www/redmine_test
Environment production
Database adapter mysql
Database schema version 20110902000000


Related issues

Related to Defect #12943: Create project error with existing project custome field ... Closed

Associated revisions

Revision 8865
Added by Jean-Philippe Lang almost 3 years ago

Fixed: error when creating a project with a version format custom field (#10218).

History

#1 Updated by Jörn Allmers almost 3 years ago

It seems as if the error is related to Custom Fields for the projects.
After we deleted a custom field (data type version) the error does not occur anymore.

#2 Updated by Jean-Philippe Lang almost 3 years ago

  • Subject changed from Creation of new projects to Error when creating a project with a version custom field
  • Category changed from Database to Custom fields
  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version set to 1.3.2
  • Resolution set to Fixed

Fixed in r8865. Thanks for pointing this out.

#3 Updated by Jean-Philippe Lang almost 3 years ago

  • Status changed from Resolved to Closed

Merged.

Also available in: Atom PDF