Defect #1781

Error deleting Users

Added by Simone Carletti over 9 years ago. Updated over 9 years ago.

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

0%

Category:Accounts / authentication
Target version:0.8
Resolution:Fixed Affected version:0.7.3

Description

Although Redmine doesn't provide a User deletion feature I think this should not prevent destroy method to crash.
Destroying a user instance causes the following error:

>> User.find_by_login('user').destroy
ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'projects.status' in 'where clause': DELETE FROM `members` WHERE ((user_id = 5) AND (projects.status=1)) 
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:150:in `log'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:281:in `execute'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:162:in `update_sql'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:296:in `update_sql'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:167:in `delete_sql'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:54:in `delete_without_query_dirty'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `delete'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:715:in `delete_all'
        from (eval):1:in `configure_dependency_for_has_many'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:311:in `call'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:311:in `callback'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:304:in `each'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:304:in `callback'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/callbacks.rb:294:in `destroy_without_transactions'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:104:in `destroy'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:80:in `transaction'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:100:in `transaction'
        from /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/transactions.rb:104:in `destroy'
        from (irb):3>

Associated revisions

Revision 1755
Added by Jean-Philippe Lang over 9 years ago

Fixed: invalid SQL query on User#destroy (#1781).

History

#1 Updated by Jean-Philippe Lang over 9 years ago

  • Category set to Accounts / authentication
  • Status changed from New to Closed
  • Target version set to 0.8
  • Resolution set to Fixed

Fixed in r1755. But as you mentioned, user deletion is not supported and should not be done.

Also available in: Atom PDF