Defect #134
closedException when deleting a tracker in Admin area
Added by Alex Mikalev about 17 years ago. Updated about 17 years ago.
0%
Description
Attempted to delete a tracker, got this:
ActiveRecord::StatementInvalid (Mysql::Error: #23000Column 'position' cannot be
null: UPDATE trackers SET `position` = NULL, `is_in_chlog` = 0, `is_in_roadmap`
= 0, `name` = 'Support' WHERE `id` = 3):
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connect
ion_adapters/abstract_adapter.rb:128:in `log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connect
ion_adapters/mysql_adapter.rb:243:in `execute'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/connect
ion_adapters/mysql_adapter.rb:258:in `update'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/base.rb
Updated by Jean-Philippe Lang about 17 years ago
I can't reproduce with the latest code.
Can you please post the full error stack and tell which
version/revision of Redmine you're using ?
Updated by Alex Mikalev about 17 years ago
I have just updated to rev. 860. Here is the full stack trace:
Processing TrackersController#index (for 192.168.1.46 at
2007-10-22 12:40:20) [GET]
Session ID: 1b884b314062cd6bc88538cdf0e936c1
Parameters: {"action"=>"index",
"controller"=>"trackers"}
DEPRECATION WARNING: paginate is deprecated and will be
removed from Rails 2.0 (Pagination is moving to a plugin in
Rails 2.0: script/plugin install
svn://errtheblog.com/svn/plugins/classic_pagination) See
http://www.rubyonrails.org/deprecation for details. (called
from list at
c:/redmine/app/controllers/trackers_controller.rb:31)
Rendering layoutfalseactionlist within layouts/base
Rendering trackers/list
Completed in 0.21800 (4 reqs/sec) | Rendering: 0.07700 (35%)
| DB: 0.11000 (50%) | 200 OK [http://biosvr101/trackers]
Processing TrackersController#destroy (for 192.168.1.46 at
2007-10-22 12:40:36) [POST]
Session ID: 1b884b314062cd6bc88538cdf0e936c1
Parameters: {"action"=>"destroy",
"id"=>"3",
"controller"=>"trackers"}
ActiveRecord::StatementInvalid (Mysql::Error: #23000Column
'position' cannot be null: UPDATE trackers SET `position` =
NULL, `is_in_chlog` = 0, `is_in_roadmap` = 0, `name` =
'Support' WHERE `id` = 3):
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/connection_adapters/abstract_adapter.rb:128:in
`log'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/connection_adapters/mysql_adapter.rb:243:in
`execute'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/connection_adapters/mysql_adapter.rb:258:in
`update'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/base.rb:1799:in
`update_without_lock'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/locking/optimistic.rb:60:in
`update_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/callbacks.rb:267:in
`update_without_timestamps'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/timestamp.rb:39:in
`update'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/base.rb:1792:in
`create_or_update_without_callbacks'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/callbacks.rb:242:in
`create_or_update'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/base.rb:1548:in
`save_without_validation'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/validations.rb:752:in
`save_without_transactions'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/transactions.rb:129:in
`save'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/connection_adapters/abstract/database_statements.rb:59:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/transactions.rb:95:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/transactions.rb:121:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/transactions.rb:129:in
`save'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/validations.rb:773:in
`update_attribute'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/acts/list.rb:126:in
`remove_from_list'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/callbacks.rb:333:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/callbacks.rb:333:in
`callback'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/callbacks.rb:330:in
`each'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/callbacks.rb:330:in
`callback'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/callbacks.rb:320:in
`destroy_without_transactions'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/transactions.rb:125:in
`destroy'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/connection_adapters/abstract/database_statements.rb:59:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/transactions.rb:95:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/transactions.rb:121:in
`transaction'
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_rec
ord/transactions.rb:125:in
`destroy'
c:/redmine/app/controllers/trackers_controller.rb:78:in
`destroy'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/base.rb:1101:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/base.rb:1101:in
`perform_action_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/filters.rb:696:in
`call_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/filters.rb:688:in
`perform_action_without_benchmark'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/benchmarking.rb:66:in
`perform_action_without_rescue'
c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/benchmarking.rb:66:in
`perform_action_without_rescue'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/rescue.rb:83:in
`perform_action'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/base.rb:435:in
`send'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/base.rb:435:in
`process_without_filters'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/filters.rb:684:in
`process_without_session_management_support'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/session_management.rb:114:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.5/lib/action_contr
oller/base.rb:334:in
`process'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/dispatcher.rb:41:i
n
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb:
113:in
`handle_dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb:
79:in
`service'
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'
c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'
c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/webrick_server.rb:
63:in
`dispatch'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/servers/w
ebrick.rb:59
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_sup
port/dependencies.rb:495:in
`require'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_sup
port/dependencies.rb:342:in
`new_constants_in'
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_sup
port/dependencies.rb:495:in
`require'
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb
:39
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require'
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
c:/redmine/script/server:3
Updated by Jean-Philippe Lang about 17 years ago
Still can't reproduce even with Rails 1.2.5 like yours.
And what happens when you try to reorder your trackers ?
Updated by Alex Mikalev about 17 years ago
Reordering trackers works fine... Is there any information I
could supply you with for further debugging?
It attempts to set position field to NULL, what is the
correct value that is expected instead of null for a deleted
tracker?
Updated by Jean-Philippe Lang about 17 years ago
The update statement should reorder the trackers (it doesn't
apply to the deleted tracker). Your log says it's trying to update
tracker with id 3, which is not the one you're trying to delete
I suppose. This update statement is generated by acts_as_list.
I would really like to see the content of your trackers table.
Maybe there's something wrong is the current position field content
in your db.
Could you post the result of: select * from trackers ?
Updated by Alex Mikalev about 17 years ago
There you go:
id,name,is_in_chlog,position,is_in_roadmap
1,Issue,true,1,false
2,Feature,true,2,true
3,Support,false,5,false
4,Enhancement,true,3,false
5,Task,true,4,true
Updated by Jean-Philippe Lang about 17 years ago
One more thing, which one are you trying to delete ?
Updated by Alex Mikalev about 17 years ago
The "Support" one, ID=3. Thanks for any suggestions.
Updated by Jean-Philippe Lang about 17 years ago
I've tested with the same exact configuration as yours.
No error. In the log, I have:
the deletion: DELETE FROM trackers WHERE `id` = 3
followed by the reordering: UPDATE trackers SET position = (position
- 1) WHERE (1 = 1 AND position > 5)
Are you using the official 1.2.5 Rails release ? Have you made
any change to Redmine ?
Updated by Alex Mikalev about 17 years ago
Yep, using official release, did not change Redmine except
entries in configuration files. (I am a Java guy, newbie to
Ruby e al, would not have guts to mess with it :) ).
Can this be something on the db side (different MySql
engines or settings) ? I guess not...
Would you recommend I re-install Ruby, RoR, Redmine from
scratch or something else?
Updated by Jean-Philippe Lang about 17 years ago
Oh, in fact I have the same update statement as yours in the
log, before the deletion. But mysql don't raise any error, it
simply set the field to 0.
Are you running mysql in strict mode ?
Updated by Jean-Philippe Lang about 17 years ago
As acts_as_list assumes that the position field can be set to
null, I'll remove the 'not null' constraint in the db.
Updated by Jean-Philippe Lang about 17 years ago
Could you upgrade to r860 and migrate.
This problem should be fixed.
Updated by Alex Mikalev about 17 years ago
"SELECT @@global.sql_mode" gives me
STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION.
So I guess yes, strict mode.
I'll update with your latest changes and let you know if the
problem persists. Thanks!