Project

General

Profile

Actions

Defect #23495

closed

error 500 when trying to create enumeration

Added by Jeffrey Lin over 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

redmine version: redmine-3.3.0
mysql version: 5.7.9 MySQL Community Server (GPL)

database.yml:

production:
  adapter: mysql2
  database: redmine
  host: 127.0.0.1
  username: root
  password: "123456" 
  encoding: utf8

when trying to create enumeration item,
error 500 occured and the error log as below:

production.log:

Started POST "/enumerations" for 10.0.2.2 at 2016-08-02 17:11:14 +0800
Processing by EnumerationsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"1y/MDFaS0y/kgNdIhnmJtilq1vzmJ7a/a7ULs6L7/mYB80OLGXyN32vdR38dWEJGQXEkTLVbrb80wX6Uakw1vw==", "enumeration"=>{"type"=>"IssuePriority", "name"=>"1", "active"=>"1", "is_default"=>"0"}, "commit"=>"创建"}
  Current user: admin (id=1)
WARNING: Can't mass-assign protected attributes for IssuePriority: type
    lib/redmine/subclass_factory.rb:42:in `new_subclass_instance'
    app/controllers/enumerations_controller.rb:93:in `build_new_enumeration'
    lib/redmine/sudo_mode.rb:63:in `sudo_mode'
Completed 500 Internal Server Error in 37ms (ActiveRecord: 21.3ms)

ActiveRecord::StatementInvalid (Mysql2::Error: You can't specify target table 'enumerations' for update in FROM clause: UPDATE `enumerations` SET position = coalesce((
          select position
          from (select id, position from enumerations) as parent
          where parent_id = parent.id), 1) WHERE `enumerations`.`type` IN ('IssuePriority') AND (`enumerations`.`parent_id` IS NOT NULL) ORDER BY `enumerations`.`position` ASC):
  app/models/enumeration.rb:152:in `update_position'
  app/controllers/enumerations_controller.rb:47:in `create'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Actions #1

Updated by Toshi MARUYAMA over 7 years ago

  • Status changed from New to Needs feedback

It seems MySQL 5.7.9 bug.
http://stackoverflow.com/a/36432550

Actions #2

Updated by Toshi MARUYAMA about 7 years ago

  • Status changed from Needs feedback to Closed
  • Priority changed from High to Normal

MySQL 5.7 is not supported.

Actions

Also available in: Atom PDF