Opened 10 years ago

Closed 10 years ago

#1052 closed defect (fixed)

Foreign key on delete user

Reported by: ayleph Owned by:
Priority: blocker Milestone: 0.8.0
Component: programming Keywords: db, foreignkey, delete, activities
Cc: Parent Tickets:

Description

I've recently seen this in my logs.

Error - <class 'sqlalchemy.exc.IntegrityError'>: (IntegrityError) update or delete on table "core__users" violates foreign key constraint "core__activities_actor_fkey" on table "core__activities"
DETAIL:  Key (id)=(7184) is still referenced from table "core__activities".
 'DELETE FROM core__users WHERE core__users.id = %(id)s' {'id': 7184}
URL: https://goblinrefuge.com/mediagoblin/edit/account/delete/
File '/path/to/mediagoblin/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/exceptions/errormiddleware.py', line 144 in __call__
  app_iter = self.application(environ, sr_checker)
File '/path/to/mediagoblin/lib/python2.7/site-packages/Paste-1.7.5.1-py2.7.egg/paste/urlmap.py', line 203 in __call__
  return app(environ, start_response)
File '/path/to/mediagoblin/mediagoblin/app.py', line 268 in __call__
  return self.call_backend(environ, start_response)
File '/path/to/mediagoblin/lib/python2.7/site-packages/Werkzeug-0.9.6-py2.7.egg/werkzeug/wsgi.py', line 588 in __call__
  return self.app(environ, start_response)
File '/path/to/mediagoblin/mediagoblin/app.py', line 245 in call_backend
  response = controller(request)
File '/path/to/mediagoblin/mediagoblin/decorators.py', line 46 in wrapper
  return controller(request, *args, **kwargs)
File '/path/to/mediagoblin/mediagoblin/decorators.py', line 73 in new_controller_func
  return controller(request, *args, **kwargs)
File '/path/to/mediagoblin/mediagoblin/edit/views.py', line 317 in delete_account
  request.user.delete()
File '/path/to/mediagoblin/mediagoblin/db/models.py', line 179 in delete
  super(User, self).delete(**kwargs)
File '/path/to/mediagoblin/mediagoblin/db/base.py', line 50 in delete
  sess.commit()
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py', line 724 in commit
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py', line 354 in commit
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py', line 334 in _prepare_impl
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py', line 1828 in flush
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py', line 1946 in _flush
File 'build/bdist.linux-x86_64/egg/sqlalchemy/util/langhelpers.py', line 58 in __exit__
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/session.py', line 1910 in _flush
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/unitofwork.py', line 372 in execute
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/unitofwork.py', line 553 in execute
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/persistence.py', line 116 in delete_obj
File 'build/bdist.linux-x86_64/egg/sqlalchemy/orm/persistence.py', line 661 in _emit_delete_statements
File 'build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py', line 662 in execute
File 'build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py', line 761 in _execute_clauseelement
File 'build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py', line 874 in _execute_context
File 'build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py', line 1024 in _handle_dbapi_exception
File 'build/bdist.linux-x86_64/egg/sqlalchemy/util/compat.py', line 196 in raise_from_cause
File 'build/bdist.linux-x86_64/egg/sqlalchemy/engine/base.py', line 867 in _execute_context
File 'build/bdist.linux-x86_64/egg/sqlalchemy/engine/default.py', line 324 in do_execute
IntegrityError: (IntegrityError) update or delete on table "core__users" violates foreign key constraint "core__activities_actor_fkey" on table "core__activities"
DETAIL:  Key (id)=(7184) is still referenced from table "core__activities".
 'DELETE FROM core__users WHERE core__users.id = %(id)s' {'id': 7184}

Change History (3)

comment:1 by Jessica Tallon, 10 years ago

Milestone: 0.8.0
Priority: majorblocker

comment:2 by Jessica Tallon, 10 years ago

Owner: set to Jessica Tallon
Status: newin_progress

comment:3 by Jessica Tallon, 10 years ago

Owner: Jessica Tallon removed
Resolution: fixed
Status: in_progressclosed

This should be fixed by 63d6953. Please test this and re-open if you find any problems.

Note: See TracTickets for help on using tickets.