Project

General

Profile

Actions

Anomalie #3098

closed

CRASH when adding OPE

Added by Yann Le Jeune about 8 years ago. Updated almost 8 years ago.

Status:
Résolu
Priority:
Urgent
Assignee:
Category:
-
Target version:
Start date:
21 April 2016
Due date:
% Done:

0%

Estimated time:
Élément(s):
Difficulté:

Description

Seens on paleosystem freshly updated : crash at the end of add wizard

Seems to be linked to a newly added type of OPE.

IntegrityError at /operation_creation/done

ERREUR: une instruction insert ou update sur la table « archaeological_operations_operation » viole la contrainte de clé

étrangère « operation_type_id_refs_id_42550446d799660b »

DETAIL: La clé (operation_type_id)=(4) n'est pas présente dans la table « archaeological_operations_operationtypeold ».

Request Method: GET

Request URL: http://ishtar-nhi.paleosystem.fr/operation_creation/done

Django Version: 1.4.5

Exception Type: IntegrityError

Exception Value:

ERREUR: une instruction insert ou update sur la table « archaeological_operations_operation » viole la contrainte de clé

étrangère « operation_type_id_refs_id_42550446d799660b »

DETAIL: La clé (operation_type_id)=(4) n'est pas présente dans la table « archaeological_operations_operationtypeold ».

Exception Location: /usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py in _commit, line 235

Python Executable: /usr/bin/uwsgi-core

Python Version: 2.7.3

Python Path:

['/srv/ishtar-NHI/ishtar/',

'.',

'',

'/usr/lib/python2.7',

'/usr/lib/python2.7/plat-linux2',

'/usr/lib/python2.7/lib-tk',

'/usr/lib/python2.7/lib-old',

'/usr/lib/python2.7/lib-dynload',

'/usr/local/lib/python2.7/dist-packages',

'/usr/lib/python2.7/dist-packages',

'/usr/lib/python2.7/dist-packages/PIL',

'/usr/lib/python2.7/dist-packages/gtk-2.0',

'/usr/lib/pymodules/python2.7']

Server time: jeu, 21 Avr 2016 20:54:32 +0200

Traceback:

File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response

  1. response = callback(request, *callback_args, **callback_kwargs)

File "/srv/ishtar-NHI/ishtar/ishtar_common/wizards.py" in _wrapped_view

  1. return view_func(request, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py" in view

  1. return self.dispatch(request, *args, **kwargs)

File "/srv/ishtar-NHI/ishtar/ishtar_common/wizards.py" in dispatch

  1. return super(Wizard, self).dispatch(request, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/django/contrib/formtools/wizard/views.py" in dispatch

  1. response = super(WizardView, self).dispatch(request, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch

  1. return handler(request, *args, **kwargs)

File "/usr/lib/python2.7/dist-packages/django/contrib/formtools/wizard/views.py" in get

  1. ), **kwargs)

File "/usr/lib/python2.7/dist-packages/django/contrib/formtools/wizard/views.py" in render_done

  1. return super(NamedUrlWizardView, self).render_done(form, **kwargs)

File "/usr/lib/python2.7/dist-packages/django/contrib/formtools/wizard/views.py" in render_done

  1. done_response = self.done(final_form_list, **kwargs)

File "/srv/ishtar-NHI/ishtar/ishtar_common/wizards.py" in done

  1. return_object)

File "/srv/ishtar-NHI/ishtar/ishtar_common/wizards.py" in save_model

  1. obj.save()

File "/srv/ishtar-NHI/ishtar/archaeological_operations/models.py" in save

  1. return super(Operation, self).save(*args, **kwargs)

File "/srv/ishtar-NHI/ishtar/ishtar_common/models.py" in save

  1. super(BaseHistorizedItem, self).save(*args, **kwargs)

File "/usr/lib/python2.7/dist-packages/django/db/models/base.py" in save

  1. self.save_base(using=using, force_insert=force_insert, force_update=force_update)

File "/usr/lib/python2.7/dist-packages/django/db/models/base.py" in save_base

  1. transaction.commit_unless_managed(using=using)

File "/usr/lib/python2.7/dist-packages/django/db/transaction.py" in commit_unless_managed

  1. connection.commit_unless_managed()

File "/usr/lib/python2.7/dist-packages/django/db/backends/init.py" in commit_unless_managed

  1. self._commit()

File "/usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py" in _commit

  1. return self.connection.commit()

Exception Type: IntegrityError at /operation_creation/done

Exception Value: ERREUR: une instruction insert ou update sur la table « archaeological_operations_operation » viole la contrainte de clé

étrangère « operation_type_id_refs_id_42550446d799660b »

DETAIL: La clé (operation_type_id)=(4) n'est pas présente dans la table « archaeological_operations_operationtypeold ».

Actions #1

Updated by Étienne Loks almost 8 years ago

  • Status changed from Nouveau to Résolu

Bad migration on some instances. This should be fixed.

To fix it manualy. Connect to the database. With \d archaeological_operations_operation get the name of the foreign key constraint regarding operation_type_id (something like operation_type_id_refs_id_42550446d799660b) and drop the constraint:

ALTER TABLE archaeological_operations_operation DROP CONSTRAINT operation_type_id_refs_id_42550446d799660b;

And recreate it:

ALTER TABLE archaeological_operations_operation
    ADD CONSTRAINT operation_type_id_refs_id_123456789
        FOREIGN KEY (operation_type_id) REFERENCES ishtar_common_operationtype (id) MATCH FULL;
Actions

Also available in: Atom PDF