Я работаю с Django + PostgreSQL и по некоторым причинам восстановил резервную копию из своего старого дампа БД на текущую БД. Из-за этого были нарушены последовательности нескольких таблиц, и я не могу создать нового суперпользователя Django из-за этого. Может кто-нибудь помочь мне с тем, как я могу изменить последовательность всего БД с помощью любой команды PSQL.
Ошибка трассировки, если я неверно истолковал ошибку:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 63, in execute
return super(Command, self).execute(*args, **options)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
output = self.handle(*args, **options)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/contrib/auth/management/commands/createsuperuser.py", line 183, in handle
self.UserModel._default_manager.db_manager(database).create_superuser(**user_data)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/contrib/auth/models.py", line 168, in create_superuser
return self._create_user(username, email, password, **extra_fields)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/contrib/auth/models.py", line 151, in _create_user
user.save(using=self._db)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/contrib/auth/base_user.py", line 80, in save
super(AbstractBaseUser, self).save(*args, **kwargs)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/models/base.py", line 796, in save
force_update=force_update, update_fields=update_fields)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/models/base.py", line 824, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/models/base.py", line 908, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/models/base.py", line 947, in _do_insert
using=using, raw=raw)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/models/query.py", line 1045, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 1054, in execute_sql
cursor.execute(sql, params)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/backends/utils.py", line 79, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/home/orion/workspace/buddy/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: duplicate key value violates unique constraint "auth_user_pkey"
DETAIL: Key (id)=(1198) already exists.