Opened 6 years ago

Closed 6 years ago

#30105 closed Bug (fixed)

Fix django test running ordering for partial unique constraint

Reported by: Pavel Tyslacki Owned by: Pavel Tyslacki
Component: Database layer (models, ORM) Version: 2.1
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Pavel Tyslacki)

Bug come from #30062:

 ./tests/runtests.py migrations --parallel=1 --reverse --failfast
...
======================================================================
ERROR: test_create_model_with_partial_unique_constraint (migrations.test_operations.OperationTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tim/code/django/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/backends/sqlite3/base.py", line 376, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: index test_constraint_pony_pink_for_weight_gt_5_uniq already exists

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/tim/code/django/tests/migrations/test_operations.py", line 527, in test_create_model_with_partial_unique_constraint
    operation.database_forwards('test_crmo', editor, project_state, new_state)
  File "/home/tim/code/django/django/db/backends/sqlite3/schema.py", line 35, in __exit__
    super().__exit__(exc_type, exc_value, traceback)
  File "/home/tim/code/django/django/db/backends/base/schema.py", line 110, in __exit__
    self.execute(sql)
  File "/home/tim/code/django/django/db/backends/base/schema.py", line 137, in execute
    cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/tim/code/django/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/tim/code/django/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/tim/code/django/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/backends/sqlite3/base.py", line 376, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.OperationalError: index test_constraint_pony_pink_for_weight_gt_5_uniq already exists

Change History (3)

comment:1 by Pavel Tyslacki, 6 years ago

Owner: changed from nobody to Pavel Tyslacki
Status: newassigned

comment:2 by Pavel Tyslacki, 6 years ago

Description: modified (diff)

comment:3 by Tim Graham, 6 years ago

Component: UncategorizedDatabase layer (models, ORM)
Resolution: fixed
Status: assignedclosed
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

For future reference, a new ticket isn't really needed. We normally just reference the recently fixed issue.

Note: See TracTickets for help on using tickets.
Back to Top